BookmarkSubscribeRSS Feed
mlblac5
Calcite | Level 5

Hi All! Looking for some assistance as a new SAS Studio user. I am attempting to run a conditional if statement to print only the presidents from Ohio based on the 'Home_State' variable. However, it comes back with zero observations. Below I have included the code I used and log.

 

data OhioPresidents;
	SET MINE.USPRESIDENT;
	
	if Home_State = 'ohio';
	Keep President Wikipedia_Entry Took_Office Left_Office Party Portrait Thumbnail Home_State;
run;
proc print data OhioPresidents;
run;

 

mlblac5_0-1610666326426.png

 

 

1 REPLY 1
Kurt_Bremser
Super User
if Home_State = 'ohio';

If home_state is actually "Ohio", this condition will not catch it. The spelling must match exactly.

proc print data=OhioPresidents;

Note the necessary =.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 1 reply
  • 914 views
  • 0 likes
  • 2 in conversation