New SAS User

Completely new to SAS or trying something new with SAS? Post here for help getting started.
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
mvhoya
Obsidian | Level 7

Hi SAS communities,

 

I am attempting to use a WHERE= option in my ODS Output statement to pull in observations where variable HypRelDeathInd=1 and variable StateCd is a non-missing value. I've tried using a MISSING function by coding it as "WHERE Not Missing(StateCd)", but that yielded a syntax error in the log. Any other suggestions for how I can change my code to pull in non-missing values for my StateCd variable? Thank you in advance! 

 

Here is the code I've described:

PROC FREQ DATA = Work.Analysis2;
	TABLES HypRelDeathInd*StateCd / NOPERCENT NOROW CHISQ;
	ODS OUTPUT CrossTabFreqs = HypRslt.StatePercents (WHERE = (HypRelDeathInd=1 and WHERE Not Missing(StateCd)));
	ODS OUTPUT ChiSq = HypRslt.ChiSqResults (WHERE = (Statistic='Chi- Square'));
	RUN;
	QUIT;

 

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21
WHERE = (HypRelDeathInd=1 and Not Missing(StateCd))

or

WHERE = (HypRelDeathInd=1 and StateCd is not missing)
PG

View solution in original post

2 REPLIES 2
PGStats
Opal | Level 21
WHERE = (HypRelDeathInd=1 and Not Missing(StateCd))

or

WHERE = (HypRelDeathInd=1 and StateCd is not missing)
PG
tmlee02
Fluorite | Level 6

Hey,

 

Try using the ODS OUTPUT statement first then the PROC FREQ

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1070 views
  • 3 likes
  • 3 in conversation