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

Hi - I'm a very new user to SAS and I'm having trouble with some code.  Here is my problem:

I have a data set from which I need to identify the number of respondents who meet certain criteria under 5 variables.  The variables in the data set, and how they are coded, are as follows:

Variable                    Coding

H2g                         0,1,2,3,4,5,6,8

H2h                         0,1,2,3,4,5,6,8

H2i                          0,1,2,3,4,5,6,8

H2j                          0,1,2,3,4,5,6,8

aR3                         BA0, BB0, PE0, PD0, PC0, PB0, PA0, IB0, IA0  

so the code I have is:

data in;

set Baseline.Baseline;

if setting=2;

run;

proc print;

where H2i <=2 AND H2g <=2 AND H2h <=2 AND H2j<=2 AND aR3=PA0;

run;

I get multiple errors, one being that PA0 is not a recognized variable, which is wrong because it is not a variable. 

Can someone help me fix this please?!  I'm quite frustrated by it!  I don't even know if I have the right proc

Thank you so much!

Shannon

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

you're comparing text so put PA0 in quotation marks.

data in;

set Baseline.Baseline;

if setting=2;

run;

proc print;

where H2i <=2 AND H2g <=2 AND H2h <=2 AND H2j<=2 AND aR3="PA0";

run;

View solution in original post

3 REPLIES 3
Reeza
Super User

you're comparing text so put PA0 in quotation marks.

data in;

set Baseline.Baseline;

if setting=2;

run;

proc print;

where H2i <=2 AND H2g <=2 AND H2h <=2 AND H2j<=2 AND aR3="PA0";

run;

AncaTilea
Pyrite | Level 9

hi.first thing i can think of is to place quotes for the last variable..ar3 eq 'PA0'

mrs_oj
Calcite | Level 5

Thank you so much!!  Something so simple, and yet so frustrating Smiley Happy

sas-innovate-2024.png

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.

 

Register now!

How to Concatenate Values

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.

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
  • 376 views
  • 3 likes
  • 3 in conversation