BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jkf91
Calcite | Level 5

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

1 ACCEPTED SOLUTION

Accepted Solutions
robby_beum
Quartz | Level 8

Instead of using "quit;"  - use a "run;"

View solution in original post

3 REPLIES 3
art297
Opal | Level 21

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.

jkf91
Calcite | Level 5

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;

robby_beum
Quartz | Level 8

Instead of using "quit;"  - use a "run;"

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 944 views
  • 3 likes
  • 3 in conversation