BookmarkSubscribeRSS Feed
Talwinder
Calcite | Level 5

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.

2 REPLIES 2
ChrisNZ
Tourmaline | Level 20

Like this?

 


%macro new (date=);
  proc print data=tab1;
  where saledate ="&date"d ;
  run;
%mend;
%new (date=07feb2003);
Talwinder
Calcite | Level 5

Yes. 

 

Thanks alot

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 687 views
  • 0 likes
  • 2 in conversation