Hello there,
SAS keeps saying that the variable type is not on file....What does this mean? WHen I did a one way frequency table without the where statement it ran...But when I made this edit, it didn't.
Code: proc freq data=WORK.SYPHILIS; tables genderB genderC sex_o RACE age / plots=(freqplot cumfreqplot); where Type in ("genderB", "genderC", "sex_o", "race") and 18<=age<=50; run; Log: 1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; SYMBOLGEN: Macro variable _SASWSTEMP_ resolves to /home/u49152646/.sasstudio/.images/db1b9e49-6774-45a2-9899-069be7ad3673 SYMBOLGEN: Some characters in the above value which were subject to macro quoting have been unquoted for printing. SYMBOLGEN: Macro variable GRAPHINIT resolves to GOPTIONS RESET=ALL GSFNAME=_GSFNAME; 72 73 /* 74 * 75 * Task code generated by SAS Studio 3.8 76 * 77 * Generated on '8/10/20, 8:32 AM' 78 * Generated by 'u49152646' 79 * Generated on server 'ODAWS03-USW2.ODA.SAS.COM' 80 * Generated on SAS platform 'Linux LIN X64 3.10.0-1062.9.1.el7.x86_64' 81 * Generated on SAS version '9.04.01M6P11072018' 82 * Generated on browser 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) 82 ! Chrome/84.0.4147.105 Safari/537.36' 83 * Generated on web client 83 ! 'https://odamid-usw2.oda.sas.com/SASStudio/main?locale=en_US&zone=GMT-07%253A00&ticket=ST-27624-sinmcsizLgE19kH9QBkl-cas' 84 * 85 */ 86 87 proc freq data=WORK.SYPHILIS; 88 tables genderB genderC sex_o RACE age / plots=(freqplot cumfreqplot); 89 where Type in ("genderB", "genderC", "sex_o", "race") and 18<=age<=50; ERROR: Variable Type is not on file WORK.SYPHILIS.
And I already imported the CSV file into SAS
That worked but it gave me a frequency table for all ages and not age 18-50 like before. My instructions were to create a frequency table of current gender and sexual orientation for patients between the age of 18 - 50 years.
proc freq data=WORK.SYPHILIS; proc contents data=work.syphilis; tables genderB genderC sex_o RACE age / plots=(freqplot cumfreqplot); where Type in ("genderB", "genderC", "sex_o", "RACE") and 18<=age<=50; run;
variables called genderB and genderC
Thank you!
proc freq data=WORK.SYPHILIS;
where18<=age<=50;
tables genderB genderC sex_o RACE age / plots=(freqplot cumfreqplot);
run;
This is likely what you want.
Your TYPE portion doesn't make sense since those are variable names. Not sure what you were expecting to happen within that portion of code but it doesn't do what you think it does 🙂
It worked! Thank you!
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Early bird rate extended! Save $200 when you sign up by March 31.
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.