Hello,
I would like to get the counts for any variables equal to 1; I use Proc Freq table below. Why SAS showed an error message? Thank you.
proc freq data=H4_SEC_UC;
table sec_noumedcond sec_uasthma;
where (sec_noumedcond=1 or sec_uasthma=1);
run;
211 proc freq data=H4_SEC_UC; 212 table sec_noumedcond sec_uasthma ; 219 where (sec_noumedcond=1 or sec_uasthma=1); ERROR: WHERE clause operator requires compatible variables. 226 run; NOTE: The SAS System stopped processing this step because of errors.
The error message suggests that at least one of the variables on your WHERE statement are character rather than numeric. So you would need to code perhaps:
where (sec_noumedcond='1' or sec_uasthma='1');
'Compatible' in the error message means being the correct type. The WHERE statement doesn't do automatic numeric to character conversions. If you don't know which variable is character, you can run PROC CONTENTS on the dataset.
The error message suggests that at least one of the variables on your WHERE statement are character rather than numeric. So you would need to code perhaps:
where (sec_noumedcond='1' or sec_uasthma='1');
'Compatible' in the error message means being the correct type. The WHERE statement doesn't do automatic numeric to character conversions. If you don't know which variable is character, you can run PROC CONTENTS on the dataset.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.