BookmarkSubscribeRSS Feed
rishabhmehra13
Calcite | Level 5

Hi,
i am having problems using mcros.Not getting the desired output

 

data cudata;
input ID Orderdate$ Model$12. Quantity ;
cards;
287 15OCT03 DeltaBreeze 15
287 15OCT03 SantaAna 15
274 16OCT03 JetStream 1
174 17OCT03 SantaAna 20
174 17OCT03 Noreaster 5
174 17OCT03 Scirocco 1
347 18OCT03 Mistral 1
287 21OCT03 DeltaBreeze 30
287 21OCT03 SantaAna 25
run;


%macro cus(dsn);

%if &sysday=Monday
%then %do;
proc print data=&dsn;
run;
%end;

%else %if &sysday=Thursday
%then %do;
proc tabulate data=&dsn;
class ID;
var Quantity ;
table ID,Quantity;

run;

%end;


%mend cus;

%cus(cudata);

 

 

log

NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space
between a quoted string and the succeeding identifier is recommended.
2 REPLIES 2
RW9
Diamond | Level 26 RW9
Diamond | Level 26

The problem is most likely not with that code directly.  If you run code which has an open quote, i.e. a quote mark with no closing mark, then SAS treates everything after that as being text.  That is what the warning is telling you that it has read a certain amount of "text" and thinks you have unbalanced quote marks.  Simplest solution, restart the SAS system to get a fresh session, and check any code you write to ensure all quoted strings is finished.

Also note, why bother with the whole macro thing?  Just run a proc print an tabulate, takes a fraction of a second, then send out one or the other file.

zekeT_sasaholic
Quartz | Level 8

This isnt a full solution for you.

But the macro part of your problem works fine. 

That message is a warning that in future versions of SAS there will be a modification on how to use that style of code you tried for macros.

What version are you on?  I'm on 9.4.  so if you are on an earlier version that would explain things.  and it hampers my ability to recreate the exact message.

 

I'd like to suggest a few things...

1. your data step isnt reading in your data correctly.  Use:   infile datalines truncover;   

2. on things like the -tuesday- , -thursday-.  Try with them in quotes.

3. the use of %macro cus(dsn);   isnt bad - but might i suggest naming the macro variable?  Its easier to read... Example:   %macro cus(dsn=);     then when you call it you can use:    %cus(dsn=cudata);  Its expecially helpful with a macro that has many variables.

 

hth

 

zeke torres

wcsug.com

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 827 views
  • 3 likes
  • 3 in conversation