I follow these codes from
https://www.youtube.com/watch?v=fFfxPqNzNJc
But I am not sure why it does not run in SAS University Edition.
Appreciates your comments. Phan S.
data _null_;
set sashelp.cars;
where strip(make)='Acura' and strip(model)='MDX';
call symputx('MDX_Price',msrp);
/*%let MDX_Price = msrp;*/
run;
option nosource;
%put ==================================;
%put the MSRP for an Acura MDX is &MDX_Price..;
%put ==================================;
option source;
proc sql noprint;
select age
into: alfred_age
from sashelp.class
where name='Alfred';
quit;
proc sql noprint;
select weight into: MDX_Weight trimmed
from sashelp.cars
where strip(make)='Acura' and strip(model)='MDX';
quit;
option nosource;
%put ==================================;
%put the MSRP for an Acura MDX is &MDX_Weight..;
%put ==================================;
option source;
Hello ballardw (Super User),
I closed and reopened SAS and it appears to run (See attached).
Phan S.
For posts related to "why this didn't run" you should supply the LOG of your attempt to run the code along with any errors or warnings. Copy the text from the LOG and paste into a code box opened on the forum with the </> icon.
Pasting into the code box is important because SAS often supplies diagnostic characters that the main message window will reformat so they appear in a position other that SAS wrote them originally.
Since %put only writes to the log then you would not see anything appear in other result windows if that is what you expected.
I can run the code and get reasonable results from the %put statements.
Hello ballardw (Super User),
I closed and reopened SAS and it appears to run (See attached).
Phan S.
@PhanS wrote:
Hello ballardw (Super User),
I closed and reopened SAS and it appears to run (See attached).
Phan S.
Working with macro code requires significant attention to detail. You can create instances where "something" , varies on what you attempt, isn't closed properly and so code generated or variables are not actually seen by the SAS code compiler as you think.
One symptom is submitting code and nothing happening. At which point often the solution is to save your code and restart SAS. Then very carefully want the macro bits next time as you may have saved an error that will cause this all over again.
Hi Cynthia,
Very sorry for my late reply. I just saw your post.
My SAS University was freeze.
It has resolved the issue after I saved my codes, closed SAS, and resubmitted the same codes.
Next time, I will remember to present Log messages.
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.