SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

subsetting using the IF statement

Reply
New Contributor
Posts: 2

subsetting using the IF statement

Hi!

 

am new to SAS and stuck.  trying to get a subset of my data using this code:

data  sasuser.op2;
set sasuser.op
if DEPRES = 1;
run;
proc freq;
tables DEPRES;
run;

 

Super User
Posts: 20,252

Re: subsetting using the IF statement


pamelisa wrote:

Hi!

 

am new to SAS and stuck.  trying to get a subset of my data using this code:

data  sasuser.op2;
set sasuser.op
if DEPRES = 1;
run;
proc freq;
tables DEPRES;
run;

 

 

You forgot a semicolon after the SET statement.

 

Please include your log and a detailed explanation of what your problem is....you never actually say what happens or what's not working so I'm guessing at the issue right now.

PROC Star
Posts: 7,543

Re: subsetting using the IF statement

Of course, if you don't actually need the subset file, the following would run faster:

proc freq data=sasuser.op (where=(DEPRES = 1));
  tables DEPRES;
run;

Art, CEO, AnalystFinder.com

 

New Contributor
Posts: 2

Re: subsetting using the IF statement

Thank you!!
SAS Super FREQ
Posts: 385

Re: subsetting using the IF statement

Your SET statement is missing a semicolon.

Ask a Question
Discussion stats
  • 4 replies
  • 194 views
  • 2 likes
  • 4 in conversation