10-04-2016 09:34 AM
i am having problems using mcros.Not getting the desired output
input ID Orderdate$ Model$12. Quantity ;
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
proc print data=&dsn;
%else %if &sysday=Thursday
proc tabulate data=&dsn;
var Quantity ;
10-04-2016 09:56 AM
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.
10-04-2016 10:04 AM
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.