From: Yu Zhang on
move the %put after the RUN; should be working. the %put before RUN will be
executed at the datastep complie time. at that time, the macro variables are
not available yet.

HTH

Yu

On Mon, Feb 22, 2010 at 2:31 PM, N Shah <nshah6(a)luc.edu> wrote:

> Thank you for your response in advance.
>
> filename readin "~/test/test.txt";
> filrname output "~/test/test.html";
>
> data _null_;
> length title number $40 ;
> infile readin end=eof;
> input number title;
> call symput('count',number);
> call symput('name',title);
> %put _user_ ;
> file output;
> %put "This &name has &count records" ;
> run;
>
> What is wrong in above code ? I am getting an error that "Apparent symbolic
> reference NAME/Number not resolved."
>
> For testing purpose, there is one record in the file with below values:
> Title Number
> 1. Test.txt 100
>
> I appreciate your time
>
From: N Shah on
But what if I need to resolve the Macro variables in the same Data step ?

is it even possible ?

Thank you !
From: Yu Zhang on
you can use symget function to reference it.

Thanks!

Yu

On Mon, Feb 22, 2010 at 3:37 PM, N Shah <nshah6(a)luc.edu> wrote:

> But what if I need to resolve the Macro variables in the same Data step ?
>
> is it even possible ?
>
> Thank you !
>
From: Arthur Tabachneck on
As Yu mentioned you can access it with symget. But, why would you need to
access it in the same data step when you already have direct access to the
variable on which it is based?

Just wondering,
Art
-------
On Mon, 22 Feb 2010 16:37:59 -0500, N Shah <nshah6(a)LUC.EDU> wrote:

>But what if I need to resolve the Macro variables in the same Data step ?
>
>is it even possible ?
>
>Thank you !
From: N Shah on
Art,

In order not to complicate matter, I put only part of code that I see the
problem.

My end goal is to format the output file and send it as an email.

The output file that I am showing in the example is not going to be HTML but
will be used as email message . so my output statement will be

filename Output email ......;

The message that I want in body of the email need to be formatted. that is
"Title" and "Number"

so I want my %put statement to look like,

%put "<font face-'Calibri' size=3.5> This <b> &name </b> has <u> &count </u>
</font> records"

since I am reading the file in data _null_ statement , I need to either read
"Number" and "Title" columns as macro variable or convert both to macro
variable.

so that when I use %put statement it resolves the variables correctly and
format accordingly.

I hope it make sense. I also apologies for not providing enough information
first time around.


On Mon, 22 Feb 2010 17:47:03 -0500, Arthur Tabachneck <art297(a)NETSCAPE.NET>
wrote:

>As Yu mentioned you can access it with symget. But, why would you need to
>access it in the same data step when you already have direct access to the
>variable on which it is based?
>
>Just wondering,
>Art
>-------
>On Mon, 22 Feb 2010 16:37:59 -0500, N Shah <nshah6(a)LUC.EDU> wrote:
>
>>But what if I need to resolve the Macro variables in the same Data step ?
>>
>>is it even possible ?
>>
>>Thank you !

Thank you for your response in advance.

filename readin "~/test/test.txt"; filrname output "~/test/test.html";

data _null_; length title number $40 ; infile readin end=eof; input number
title; call symput('count',number); call symput('name',title); %put _user_ ;
file output; %put "This &name has &count records" ; run;

What is wrong in above code ? I am getting an error that "Apparent symbolic
reference NAME/Number not resolved."

For testing purpose, there is one record in the file with below values:
Title Number 1. Test.txt 100

I appreciate your time
 |  Next  |  Last
Pages: 1 2 3
Prev: Re Spectral Analysis
Next: DDE not responding in SAS