Hello,
I'm trying to get the see the frequency of a specific variable characteristics using Proc statements. And nothing is working. Please see some of my attempts of coding with defining variable characteristics. Please help!
Thanks,
LMP
libname mydata "/folders/myfolders"; run; PROC TABULATE DATA=mydata.v1Mort715; Class sna2010_na; TABLES sna2010_na, leadingcau='15' , Tobac='y'; RUN; Proc freq data=mydata.v1Mort715; tables sna2010_na * leadingcau=15; run; Proc means data=mydata.v1Mort715; freq sna2010_na * leadingcau(15) *tobac=y; run;
So that tells you what the problem is, this:
proc freq data=mydata.v1mort715; tables sna2010_na * leadingcau=15; run;
Is invalid as =15 cannot be part of the tables definition. Perhaps there is an option you want, options appear after a slash, e.g. if I want and output dataset:
proc freq data=mydata.v1mort715; tables sna2010_na * leadingcau / out=want; run;
Examples:
"Nothing is working" - this means nothing, what "isn't working", maybe you haven't got the computer switched on for all we know. This looks fine:
proc freq data=mydata.v1mort715; tables sna2010_na * leadingcau=15; run;
And will print freq output to the listing window, assuming the library/dataset exists and contains those variables.
Also don't code in uppercase.
Please see the attached screen shot of the error within the log for that particular code.
So that tells you what the problem is, this:
proc freq data=mydata.v1mort715; tables sna2010_na * leadingcau=15; run;
Is invalid as =15 cannot be part of the tables definition. Perhaps there is an option you want, options appear after a slash, e.g. if I want and output dataset:
proc freq data=mydata.v1mort715; tables sna2010_na * leadingcau / out=want; run;
Examples:
Thank you!
Your tabulate code would have ERRORS about variables with undefined roles. Add the other two variables to a CLASS statement;
Proc means Freq only allows one variable and it should be one that represents how many times each record is used.
In general:
Doesn't work is awful vague.
Are there errors in the log?: Post the code and log in a code box opened with the {i} to maintain formatting of error messages.
No output? Post any log in a code box.
Unexpected output? Provide input data in the form of a dataset, the actual results and the expected results. Data should be in the form of a data step. Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: