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

I need filter daily data so that only January - August are kept for each year 1999-2018 and the months September - December are removed. How do I accomplish this?

 

Below is my attempted code and the error message that follows:

data ytd_weather_jan_aug;
	set demo5.ytd_weather;
	where date like '%Jan%' or date like '%Feb%' or date like '%Mar%' or date like '%Apr%' or date like '%May%' or date like '%Jun%' or date like '%July%' or date like '%Aug%';
run;

ERROR: WHERE clause operator requires character variables.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20
data ytd_weather_jan_aug;
	set demo5.ytd_weather;
	where 1<=month(date)<=8;
run;

View solution in original post

2 REPLIES 2
novinosrin
Tourmaline | Level 20
data ytd_weather_jan_aug;
	set demo5.ytd_weather;
	where 1<=month(date)<=8;
run;
ballardw
Super User

Or

Where month(date) in (1:8);

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!

Discussion stats
  • 2 replies
  • 1254 views
  • 4 likes
  • 3 in conversation