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

Dear team, I I have been stuck to find a solution to provide the output results for the 3 months. The solution does not work if I add months 04 and 05.

What is the best way to display the data for the condition WHERE Check = 0 and month = 03 04 05?

 

proc print data=Oth (obs=1000);
where Check=0 and month = 03;
run;
1 ACCEPTED SOLUTION

Accepted Solutions
yabwon
Onyx | Level 15

 

If month is numeric:

month in (3 4 5)

or if month is character:

 

month in ('03' '04' '05')

B.

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



View solution in original post

4 REPLIES 4
yabwon
Onyx | Level 15

 

If month is numeric:

month in (3 4 5)

or if month is character:

 

month in ('03' '04' '05')

B.

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



Stepik
Obsidian | Level 7

it is numeric, so

the code is the next:

 

proc print data=Ret_oth (obs=1000);
where Check=0 and reporting_month in (03 04 05);
run;

But still the results only provide 03 data

yabwon
Onyx | Level 15

The following:

data Ret_oth;
  do reporting_month = 1 to 5;
    Check=0; output;
    Check=1; output;
  end; 
run;

proc print data=Ret_oth (obs=1000);
where Check=0 and reporting_month in (03 04 05);
run;

works as expected.

Check you data (Maxim 3), maybe months 4 and 5 are after obs=1000?

 

Bart

 

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



Stepik
Obsidian | Level 7
correct, I need to check for more observations. Then it works. Thanks

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 4 replies
  • 588 views
  • 1 like
  • 2 in conversation