BookmarkSubscribeRSS Feed
AMMAN
Obsidian | Level 7
data  ClaimsByQuarter2;
set work.Claims;
if MOS = 'January'  then Quarter = '1';
run;

Capture.JPG

 

I can't figure out why I am getting on observation returned when I should have many that qualify.  Advice is appreciated.

 

I cannot attach the data set; its too large.

9 REPLIES 9
tomrvincent
Rhodochrosite | Level 12
if you comment it out do you get anything?
novinosrin
Tourmaline | Level 20

or leading blanks/ case sensitivity issue perhaps?

 

Try

 

if strip(upcase(MOS))='JANUARY' then quarter='1';

AMMAN
Obsidian | Level 7

Tried this.  Same result:  one line with missing values

novinosrin
Tourmaline | Level 20

lets debug

proc sql;

select distinct mos 

from have;

quit;

 

Let us know the above report

 

 

tomrvincent
Rhodochrosite | Level 12
so claims is empty.
ballardw
Super User

@AMMAN wrote:
data  ClaimsByQuarter2;
set work.Claims;
if MOS = 'January'  then Quarter = '1';
run;

Capture.JPG

 

I can't figure out why I am getting on observation returned when I should have many that qualify.  Advice is appreciated.

 

I cannot attach the data set; its too large.


Post the log entery generated when that executes.

It should have something about number of observations read and written to the output data set. If there is not indication of any read then you didn't start with a data set. If the number of observations read was 0 then the starting data set has no observations and likely have something that went wrong prior if you expect many records.

Reeza
Super User
Attach the log. Note in your code that's shown, MOS is empty so of course it's empty. Usually this means your code error out somewhere and SAS just gives a partial result. Always read the log. If you can't attach the data, at least show a proc contents on the data set and a proc freq of the MOS values. If it's a SAS date for example that won't work.
AMMAN
Obsidian | Level 7

Attached is the log.  Uninitialized

novinosrin
Tourmaline | Level 20

So likely no variable by the name MOS in your input dataset

 

verify

 

proc contents data=input;

run;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 9 replies
  • 2255 views
  • 2 likes
  • 5 in conversation