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

Hi I need some help to figure out this puzzle, I am QAing my own work, and found an error:

 

 

I have this dataset called , with a calculated column called 'week', which, from both proc freq and my eye ball checking, has values from 0 -41.But, I try to print out some extreme values, like 41, log keeps telling me 'no rows were selected'.....

 

proc freq data=numerator2_full;

tables week;

run;

 

 

a.PNG

 

 

b.PNG

 

c.PNG

 

d.PNG

 

I know this probably looks very stupid, but this has drive me crazy....

 

Thank you for your help!

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

Perhaps it is not exactly 41?

where round(week,1)=41 ;

Or perhaps you have a format attached?

data want;
 set have ;
 if strip(vvalue(week))='41';
run;

View solution in original post

9 REPLIES 9
art297
Opal | Level 21

Please post you full log, i.e., including the part where you ran the proc freq.

 

Art, CEO, AnalystFinder.com

 

Tom
Super User Tom
Super User

Perhaps it is not exactly 41?

where round(week,1)=41 ;

Or perhaps you have a format attached?

data want;
 set have ;
 if strip(vvalue(week))='41';
run;
LisaYIN9309
Obsidian | Level 7

good point @Tom, this week variable is calculated. I calculated as (Vaccine_Day - Pre_day)/7 = week format 8.0

Now I am curious to see how my 

Reeza
Super User

Ah, yes, you definitely have decimal points then. If you want it actually rounded then round the value.

 

round((Vaccine_Day - Pre_day)/7, 1) format = 8.0

Reeza
Super User

Run a PROC CONTENTS on your dataset and check the format and type. 

ShiroAmada
Lapis Lazuli | Level 10

How did you calculate the variable WEEK?

LisaYIN9309
Obsidian | Level 7
I calculated as (Vaccine_Day - Pre_start_day)/7 = week format 8.0

week is supposed to be 'at which week at pregnant a lady got her vaccine'.

Tom
Super User Tom
Super User

@LisaYIN9309 wrote:
I calculated as (Vaccine_Day - Pre_start_day)/7 = week format 8.0

week is supposed to be 'at which week at pregnant a lady got her vaccine'.


Attaching a format to a variable will change how the variable is printed, but it does not change the value. If you want WEEK to be an integer then use ROUND() or INT() function.

 

I am also curious as to why you picked 8.0 as the format to attach.  Did you really expect to have WEEK counts as high as 99 Million?

ShiroAmada
Lapis Lazuli | Level 10

you can try using int(week)=41, that should help.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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