Date: Tue, 15 Dec 2009 17:33:26 -0500
Reply-To: saslearn chicago <sasswamy@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: saslearn chicago <sasswamy@GMAIL.COM>
Subject: =?windows-1252?B?UmU6IE1BQ1JPIOKAkyB3aXRoICVJRg==?=
In-Reply-To: <20091215140418.47DF6790@resin11.mta.everyone.net>
Content-Type: text/plain; charset=windows-1252
That sounds a great idea , thanks again
- swamy
On Tue, Dec 15, 2009 at 5:04 PM, Mary <mlhoward@avalon.net> wrote:
> Yea! Someone who actually considers my idea!
>
> -Mary
>
> --- sasswamy@GMAIL.COM wrote:
>
> From: saslearn chicago <sasswamy@GMAIL.COM>
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Re: MACRO – with %IF
> Date: Tue, 15 Dec 2009 16:53:52 -0500
>
> Thanks Ronald and everyone for your help.
> I do not see any necessary for a Macro , so I am going with the data steps.
>
> - swamy
> On Tue, Dec 15, 2009 at 4:26 PM, Fehd, Ronald J. (CDC/CCHIS/NCPHI) <
> rjf2@cdc.gov> wrote:
>
> > you are still confusing macro and data step comparisons:
> >
> > from:
> > > if &site = 'A' then site_name='Test 1 ;
> >
> > to
> >
> > either of data step:
> >
> > if "&site" = "A" then site_name='Test 1';
> >
> > or inside macro statement:
> >
> > %if &site eq A %then %Let site_name = Test 1;
> >
> > Ron Fehd the macro maven CDC Atlanta GA USA RJF2 at cdc dot gov
> >
> > ________________________________
> >
> > From: saslearn chicago [mailto:sasswamy@gmail.com]
> > Sent: Tuesday, December 15, 2009 4:21 PM
> > To: Fehd, Ronald J. (CDC/CCHIS/NCPHI)
> > Cc: SAS-L@listserv.uga.edu
> > Subject: Re: MACRO – with %IF
> >
> >
> > I should make sure to give the correct example , sorry about that
> > ..
> > not necessary it would be company A , company B ...that is only
> for
> > example , it could be different values ,
> >
> > Overall ,
> > Step 1 : I would get the macro variable &site ( which would
> contain
> > either 'A' or 'B' , C . D....etc )
> > Step 2 : I need to put the Site name based on the value
> >
> > not necessary I need a macro , I thought If successful I would try
> > to pass the value as a Macro parameter , so that I can call where ever I
> > need in the code.
> >
> > can I replace with this :
> >
> > data test1;
> > %GLOBAL site_name;
> > if &site = 'A' then site_name='Test 1 ;
> > else if &site = 'B' then site_name='Abc;
> > else if &site = 'C' then site_name='XYZ;
> > else if &site = 'D' then site_name='Tst Health ;
> > run;
> >
> > - swamy
> >
> >
> > On Tue, Dec 15, 2009 at 3:57 PM, Fehd, Ronald J. (CDC/CCHIS/NCPHI)
> <
> > rjf2@cdc.gov> wrote:
> >
> >
> > > From: SAS Swamy
> > > Subject: MACRO – with %IF
> >
> > >
> > > Hello,
> > >
> > > Can someone pleast tell me what's wrong in the following
> > code , I am
> > > getting the Site details through a Macro variable &site
> ,
> > > from which I am
> > > assigning the Site name
> > > *****************************************************;
> > > %macro site_dtls;
> > > %GLOBAL sitename;
> > > %if &site = 'A' %then sname='Company A';
> > > %else %if &site = 'B' %then sname=' Company B';
> > > %else %if &site = 'C' %then sname=' Company C';
> > > %else %if &site = 'D' %then sname=' Company D';
> > > CALL SYMPUT("sitename", sname);
> > > run;
> > > %mend;
> > > %site_dtls
> > > %put &sitename;
> > > *****************************************************;
> > > I am getting the following error message :
> > > CALL SYMPUT("sitename", sname);
> > > ----
> > > 180
> > > ERROR 180-322: Statement is not valid or it is used out
> of
> > > proper order.
> >
> >
> > this is an associative array.
> >
> > %Let B = Company B;
> > %Let C = Company C;
> > %Let D = Company D;
> >
> > %Let Site = C;
> > %Let SiteName = &&&Site.;
> > %Put SiteName:&SiteName.;
> >
> > the fix to your macro is
> > you do not have a data step name:
> > DATA _Null_;
> > which is needed for the data step statement
> > call symput
> >
> > Ron Fehd the macro maven CDC Atlanta GA USA RJF2 at cdc
> > dot gov
> >
> >
>
>
>
|