From: Arthur Tabachneck on
Then, couldn't you do it with something like:

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 "<font face-'Calibri' size=3.5> This <b>" title
"</b> has <u> " number " </u></font> records";
run;

Art
-------
On Mon, 22 Feb 2010 18:05:27 -0500, N Shah <nshah6(a)LUC.EDU> wrote:

>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
From: N Shah on
Nope , it didn't work. I tired what you suggested below, but it results into
an error b/c put statement doesn't recognize double quotes within double quotes.

Put statement will take literal value in double quotes. so, "title" never
resolves to actual file name and "number" never resolves to actual record count.

I think only option left is instead of making macro variable, as suggested
by Phil, I just use the value as it is. But I will not be able to format the
values as "Bold" and "Underline" in my email message .

So my Put statement will be more like"

Put " The file name is = " title ;
Put " The record count is = " number;

I am still open to suggestion. Again, I am thankful for your detail response.

sincerely,
Shah

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

>Then, couldn't you do it with something like:
>
>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 "<font face-'Calibri' size=3.5> This <b>" title
> "</b> has <u> " number " </u></font> records";
>run;
>
>Art
>-------
>On Mon, 22 Feb 2010 18:05:27 -0500, N Shah <nshah6(a)LUC.EDU> wrote:
>
>>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
From: Tom Abernathy on
Why do you want to use macro variables?
Aren't the values for TITLE and NUMBER coming from another file or
dataset?
Or did I misunderstand your code?

If you want to include double quote character inside of a quoted
string then you need to double them.
PUT "This is ""quoted"".";

If you want to put quotes around text that you have in a variable the
use the QUOTE function. For example to store the quoted version of
the title variable into the qtitle variable use this statement.

qtitle = quote(trim(title));


On Feb 23, 11:32 am, nsh...(a)LUC.EDU (N Shah) wrote:
> Nope , it didn't work. I tired what you suggested below, but it results into
> an error b/c put statement doesn't recognize double quotes within double quotes.
>
> Put statement will take literal value in double quotes. so, "title" never
> resolves to actual file name and "number" never resolves to actual record count.
>
> I think only option left is instead of making macro variable, as suggested
> by Phil, I just use the value as it is. But I will not be able to format the
> values as "Bold" and "Underline" in my email message .
>
> So my Put statement will be more like"
>
> Put " The file name is = " title ;
> Put " The record count is = " number;
>
> I am still open to suggestion. Again, I am thankful for your detail response.
>
> sincerely,
> Shah
>
> On Mon, 22 Feb 2010 18:40:17 -0500, Arthur Tabachneck <art...(a)NETSCAPE.NET>
> wrote:
>
>
>
> >Then, couldn't you do it with something like:
>
> >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 "<font face-'Calibri' size=3.5> This <b>" title
> >      "</b> has <u> " number " </u></font> records";
> >run;
>
> >Art
> >-------
> >On Mon, 22 Feb 2010 18:05:27 -0500, N Shah <nsh...(a)LUC.EDU> wrote:
>
> >>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
> ><art...(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 <nsh...(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- Hide quoted text -
>
> - Show quoted text -

From: Joe Matise on
" ""&Hi"" " should resolve to 123. Or is Hi a sas (non-macro) variable? In
which case you can do

x = cats(" put """,Hi,"""; ");
so X will be
" put ""123""; "
which will
put "123"; in the end.

-Joe

On Tue, Feb 23, 2010 at 10:57 AM, Nrupang Shah <nshah6(a)luc.edu> wrote:

> All right. This was my bad. you are right. but I got follow up question.
>
> if the value of Hi=123, it will still resolves to "Hi" and not 123.
>
> What I am looking for is way to resolve the value of Hi to 123 in put
> statement. the problem is I don't know how to t use Macro variable that I
> create in same data step to resolve into put statement.
>
> Thanks for your inputs.
>
> sincerely,
> Shah
>
> >>> Joe Matise <snoopy369(a)gmail.com> 02/23/10 10:41 AM >>>
> Double double quotes resolve to double quotes within double quotes.
> " ""Hi!"" "
> =
> "Hi"
>
> -Joe
>
> On Tue, Feb 23, 2010 at 10:32 AM, N Shah <nshah6(a)luc.edu> wrote:
>
> > Nope , it didn't work. I tired what you suggested below, but it results
> > into
> > an error b/c put statement doesn't recognize double quotes within double
> > quotes.
> >
> > Put statement will take literal value in double quotes. so, "title" never
> > resolves to actual file name and "number" never resolves to actual record
> > count.
> >
> > I think only option left is instead of making macro variable, as
> suggested
> > by Phil, I just use the value as it is. But I will not be able to format
> > the
> > values as "Bold" and "Underline" in my email message .
> >
> > So my Put statement will be more like"
> >
> > Put " The file name is = " title ;
> > Put " The record count is = " number;
> >
> > I am still open to suggestion. Again, I am thankful for your detail
> > response.
> >
> > sincerely,
> > Shah
> >
> > On Mon, 22 Feb 2010 18:40:17 -0500, Arthur Tabachneck <
> art297(a)NETSCAPE.NET
> > >
> > wrote:
> >
> > >Then, couldn't you do it with something like:
> > >
> > >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 "<font face-'Calibri' size=3.5> This <b>" title
> > > "</b> has <u> " number " </u></font> records";
> > >run;
> > >
> > >Art
> > >-------
> > >On Mon, 22 Feb 2010 18:05:27 -0500, N Shah <nshah6(a)LUC.EDU> wrote:
> > >
> > >>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
> >
>
>
From: Arthur Tabachneck on
Are you sure you typed it correctly? The code worked as expected on my
machine (SAS9.13 on Windows server 2003).

Art
--------
On Tue, 23 Feb 2010 11:32:00 -0500, N Shah <nshah6(a)LUC.EDU> wrote:

>Nope , it didn't work. I tired what you suggested below, but it results
into
>an error b/c put statement doesn't recognize double quotes within double
quotes.
>
>Put statement will take literal value in double quotes. so, "title" never
>resolves to actual file name and "number" never resolves to actual record
count.
>
>I think only option left is instead of making macro variable, as suggested
>by Phil, I just use the value as it is. But I will not be able to format
the
>values as "Bold" and "Underline" in my email message .
>
>So my Put statement will be more like"
>
>Put " The file name is = " title ;
>Put " The record count is = " number;
>
>I am still open to suggestion. Again, I am thankful for your detail
response.
>
>sincerely,
>Shah
>
>On Mon, 22 Feb 2010 18:40:17 -0500, Arthur Tabachneck
<art297(a)NETSCAPE.NET>
>wrote:
>
>>Then, couldn't you do it with something like:
>>
>>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 "<font face-'Calibri' size=3.5> This <b>" title
>> "</b> has <u> " number " </u></font> records";
>>run;
>>
>>Art
>>-------
>>On Mon, 22 Feb 2010 18:05:27 -0500, N Shah <nshah6(a)LUC.EDU> wrote:
>>
>>>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
First  |  Prev  |  Next  |  Last
Pages: 1 2 3
Prev: Re Spectral Analysis
Next: DDE not responding in SAS