data cig.subset;
set cig.goodpanel;
by household_id;
if household_id=='2002189' then output;
quit;
I am new to SAS, and I'm not sure if the fourth line is done correctly. I tried '=' and '==' and the number without '' and with ''.
Nothing worked. Can someone please help?
Many thanks,
C
Instead of using "quit;" - use a "run;"
First you have to know whether houshold_id is numeric or character. Did your log give you an indication of what kind of error you had?
You can discover what type of field it is by running:
proc contents data=cig.goodpanel;
run;
if it is numeric then, in your code, use:
if household_id eq 2002189 then output;
although = would have worked just as well.
if it is character then it may just include extra spaces and you could try
if strip(household_id) eq "2002189" then output;
Let the forum know if that worked and, if not, post your log the next time.
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
I used the following:
data cig.test;
set cig.goodpanel;
by household_id;
if household_id eq 2002189 then output;
quit;
Instead of using "quit;" - use a "run;"
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.