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

Hello all,

Need help with this class assignment for students which does not work properly.

Here is the SAS code:

/* example 1 */

data merge1;
input ID $ SEX $ BDATE SALARY NAME $  ;
informat BDATE mmddyy8. ;
format BDATE mmddyy8. ;
datalines;
1 M 10/21/46 70000 ivan
2 F 11/01/55 68000 judy
7 M 01/27/59 47000 ralph
;
run;
data merge2;
input ID $ SEX $ BDATE SALARY TAXRATE WITHHOLD NAME $ ;
informat BDATE mmddyy8. ;
format BDATE mmddyy8. ;
datalines;
3 F 01/01/33 78000 .36 23000 zoe
5 M 03/07/29 37000 .25 9000 marco
;
run;
data merge3;
input ID $ SEX $ BDATE SALARY HEIGHT WEIGHT NAME $ ;
informat BDATE mmddyy8. ;
format BDATE mmddyy8. ;
datalines;
4 M 10/23/49 65000 68 158 roger
6 F 07/04/65 55000 74 202 clara
;
run;

data all (keep= ID BDATE SALARY NAME rename=(NAME=NAME1)) ;
set merge1 merge2 merge3 ;
where BDATE <= 01/01/60 and SALARY GE 50000 ; 
format BDATE mmddyy8. ;
run;
proc print ;
run;

This is our output:

SAS_output.JPG

The problem is that it does not select ID 3 zoe from the dataset merge2.

 

Any ideas?

Best,

 

Alen

1 ACCEPTED SOLUTION
5 REPLIES 5
saviour
Calcite | Level 5

Dear Kurt,

 

The value of your YEARCUTOFF system option was 1940.

 

That was the problem.

 

Thank you,

 

Alen

Kurt_Bremser
Super User

No, the problem is the use of 2-digit years. After Y2K (but in fact, long before that), this should be a given.

 

I am working very hard to restrain myself from using the words that came to my mind, because then a moderator would have to delete my post for vulgar language.

Tom
Super User Tom
Super User

Using the value 0.0166666... instead of zero to represent the date 01JAN1960 was also a very strange choice.

789  data _null_;
790    xx = 1/1/60 ;
791    put xx= xx= date9. ;
792  run;

xx=0.0166666667 xx=01JAN1960

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to choose a machine learning algorithm

Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 1350 views
  • 0 likes
  • 3 in conversation