DATA Step, Macro, Functions and more

SAS Macros

Reply
New Contributor
Posts: 4

SAS Macros

HI All,
i have below mentioned data.
data tab1;
input custid$ @6 saledate mmddyy10. @17 variety $9. @26 quantity ;
format saledate mmddyy10.;
datalines;
240w 02-07-2003 ginger 120
240w 02-07-2003 protea 180
356w 02-08-2003 heliconia 60
356w 02-08-2003 anthurium 300
188r 02-11-2003 ginger 24
188r 02-11-2003 anthurium 24
240w 02-12-2003 heliconia 48
240w 02-12-2003 protea 48
356w 02-12-2003 'ginger' 240
;
run;
i made below macro for same.
%macro new (flowertype=);
proc print data=tab1;
where variety ="&flowertype" & custid="&id";
run;
%mend;
%new (flowertype=ginger);

Can anyone tell me how to make macro of dates. Like i make flowertype and its ginger when i will mention any flowertype in macro then it will give me print. Same way i want to make macro of Date. if i will mention particular date then macro will show me the result of that date only.

PROC Star
Posts: 1,760

Re: SAS Macros

Posted in reply to Talwinder

Like this?

 


%macro new (date=);
  proc print data=tab1;
  where saledate ="&date"d ;
  run;
%mend;
%new (date=07feb2003);
New Contributor
Posts: 4

Re: SAS Macros

Yes. 

 

Thanks alot

Ask a Question
Discussion stats
  • 2 replies
  • 143 views
  • 0 likes
  • 2 in conversation