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

Hi ,

I am quite new using SAS studio. I started this code to analyze data in a .dat file. In the input step, I used some informats and one is mmddyy10. The problem is that in the result some dates are missing. So, I would like to know what the problem is with the code that only shows some dates and others not.

I have attached a sample of the data.
Thanks in advance

Thanks for any advice.

 WhatsApp Image 2020-02-03 at 1.22.04 PM.jpeg

 

this is the code:

 

Data assigment;
infile '/folders/myfolders/study2/MemberData_RuralHealth.dat' LRECL=50 MISSOVER ;
input
@1 Line 2.0
@3 Country $3.
@6 Cluster 4.0
@10 House_hn 4.0
@14 Househ_s 8.6
@22 Date mmddyy10.
@32 Bank_A 1.0
@33 FHMSIH 1.0
@34 Geo_zone 1.0
@35 BMI_w 4.0
@39 Hgb_w 3.1
@42 Anemia_w 1.0
@43 BMI_m 4.0
@47 Hgb_m 3.1
@50 Anemia_m 1.0
;
format Date mmddyy10. ;
run;
proc print data= assigment;
run;

 

 

 

 

This is the log results:

 

1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
72
73 Data assigment;
74 infile '/folders/myfolders/study2/MemberData_RuralHealth.dat' LRECL=50 MISSOVER ;
75 input
76 @1 Line 2.0
77 @3 Country $3.
78 @6 Cluster 4.0
79 @10 House_hn 4.0
80 @14 Househ_s 8.6
81 @22 Date mmddyy10.
82 @32 Bank_A 1.0
83 @33 FHMSIH 1.0
84 @34 Geo_zone 1.0
85 @35 BMI_w 4.0
86 @39 Hgb_w 3.1
87 @42 Anemia_w 1.0
88 @43 BMI_m 4.0
89 @47 Hgb_m 3.1
90 @50 Anemia_m 1.0
91 ;
92 format Date mmddyy10. ;
93 run;
 
NOTE: The infile '/folders/myfolders/study2/MemberData_RuralHealth.dat' is:
Filename=/folders/myfolders/study2/MemberData_RuralHealth.dat,
Owner Name=root,Group Name=vboxsf,
Access Permission=-rwxrwx---,
Last Modified=01Feb2020:15:20:50,
File Size (bytes)=35256
 
NOTE: Invalid data for Date in line 1 22-31.
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0
1 4ZZ6 1 25 104950229/06/201502219981013
Line=4 Country=ZZ6 Cluster=1 House_hn=25 Househ_s=1.049502 Date=. Bank_A=0 FHMSIH=2 Geo_zone=2 BMI_w=1998 Hgb_w=10.1 Anemia_w=3
BMI_m=. Hgb_m=. Anemia_m=. _ERROR_=1 _N_=1
NOTE: Invalid data for Date in line 10 22-31.
10 2ZZ6 3 6 26246627/08/2015001
Line=2 Country=ZZ6 Cluster=3 House_hn=6 Househ_s=0.262466 Date=. Bank_A=0 FHMSIH=0 Geo_zone=1 BMI_w=. Hgb_w=. Anemia_w=. BMI_m=.
Hgb_m=. Anemia_m=. _ERROR_=1 _N_=10
NOTE: Invalid data for Date in line 11 22-31.
11 4ZZ6 3 7 26246626/08/2015001
Line=4 Country=ZZ6 Cluster=3 House_hn=7 Househ_s=0.262466 Date=. Bank_A=0 FHMSIH=0 Geo_zone=1 BMI_w=. Hgb_w=. Anemia_w=. BMI_m=.
Hgb_m=. Anemia_m=. _ERROR_=1 _N_=11
NOTE: Invalid data for Date in line 12 22-31.
12 3ZZ6 3 12 26246628/08/2015001
Line=3 Country=ZZ6 Cluster=3 House_hn=12 Househ_s=0.262466 Date=. Bank_A=0 FHMSIH=0 Geo_zone=1 BMI_w=. Hgb_w=. Anemia_w=. BMI_m=.
Hgb_m=. Anemia_m=. _ERROR_=1 _N_=12
NOTE: Invalid data for Date in line 13 22-31.
13 5ZZ6 3 14 26246625/08/2015001
Line=5 Country=ZZ6 Cluster=3 House_hn=14 Househ_s=0.262466 Date=. Bank_A=0 FHMSIH=0 Geo_zone=1 BMI_w=. Hgb_w=. Anemia_w=. BMI_m=.
Hgb_m=. Anemia_m=. _ERROR_=1 _N_=13
NOTE: Invalid data for Date in line 14 22-31.
14 6ZZ6 3 27 26246626/08/2015001
Line=6 Country=ZZ6 Cluster=3 House_hn=27 Househ_s=0.262466 Date=. Bank_A=0 FHMSIH=0 Geo_zone=1 BMI_w=. Hgb_w=. Anemia_w=. BMI_m=.
Hgb_m=. Anemia_m=. _ERROR_=1 _N_=14
NOTE: Invalid data for Date in line 15 22-31.
15 5ZZ6 4 8 29429920/09/2015003
Line=5 Country=ZZ6 Cluster=4 House_hn=8 Househ_s=0.294299 Date=. Bank_A=0 FHMSIH=0 Geo_zone=3 BMI_w=. Hgb_w=. Anemia_w=. BMI_m=.
Hgb_m=. Anemia_m=. _ERROR_=1 _N_=15
NOTE: Invalid data for Date in line 16 22-31.
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0
16 3ZZ6 4 16 29429920/09/2015013
Line=3 Country=ZZ6 Cluster=4 House_hn=16 Househ_s=0.294299 Date=. Bank_A=0 FHMSIH=1 Geo_zone=3 BMI_w=. Hgb_w=. Anemia_w=. BMI_m=.
Hgb_m=. Anemia_m=. _ERROR_=1 _N_=16
NOTE: Invalid data for Date in line 17 22-31.
17 4ZZ6 4 24 29429920/09/2015013
Line=4 Country=ZZ6 Cluster=4 House_hn=24 Househ_s=0.294299 Date=. Bank_A=0 FHMSIH=1 Geo_zone=3 BMI_w=. Hgb_w=. Anemia_w=. BMI_m=.
Hgb_m=. Anemia_m=. _ERROR_=1 _N_=17
NOTE: Invalid data for Date in line 21 22-31.
21 1ZZ6 6 10 184670926/06/201500121051204
Line=1 Country=ZZ6 Cluster=6 House_hn=10 Househ_s=1.846709 Date=. Bank_A=0 FHMSIH=0 Geo_zone=1 BMI_w=2105 Hgb_w=12 Anemia_w=4
BMI_m=. Hgb_m=. Anemia_m=. _ERROR_=1 _N_=21
NOTE: Invalid data for Date in line 22 22-31.
22 5ZZ6 6 12 184670925/06/2015001
Line=5 Country=ZZ6 Cluster=6 House_hn=12 Househ_s=1.846709 Date=. Bank_A=0 FHMSIH=0 Geo_zone=1 BMI_w=. Hgb_w=. Anemia_w=. BMI_m=.
Hgb_m=. Anemia_m=. _ERROR_=1 _N_=22
NOTE: Invalid data for Date in line 23 22-31.
23 2ZZ6 6 25 184670926/06/2015011
Line=2 Country=ZZ6 Cluster=6 House_hn=25 Househ_s=1.846709 Date=. Bank_A=0 FHMSIH=1 Geo_zone=1 BMI_w=. Hgb_w=. Anemia_w=. BMI_m=.
Hgb_m=. Anemia_m=. _ERROR_=1 _N_=23
NOTE: Invalid data for Date in line 24 22-31.
24 1ZZ6 6 26 184670927/06/2015001
Line=1 Country=ZZ6 Cluster=6 House_hn=26 Househ_s=1.846709 Date=. Bank_A=0 FHMSIH=0 Geo_zone=1 BMI_w=. Hgb_w=. Anemia_w=. BMI_m=.
Hgb_m=. Anemia_m=. _ERROR_=1 _N_=24
NOTE: Invalid data for Date in line 25 22-31.
25 10ZZ6 6 30 184670927/06/2015011
Line=10 Country=ZZ6 Cluster=6 House_hn=30 Househ_s=1.846709 Date=. Bank_A=0 FHMSIH=1 Geo_zone=1 BMI_w=. Hgb_w=. Anemia_w=. BMI_m=.
Hgb_m=. Anemia_m=. _ERROR_=1 _N_=25
NOTE: Invalid data for Date in line 26 22-31.
26 8ZZ6 6 31 184670927/06/2015001
Line=8 Country=ZZ6 Cluster=6 House_hn=31 Househ_s=1.846709 Date=. Bank_A=0 FHMSIH=0 Geo_zone=1 BMI_w=. Hgb_w=. Anemia_w=. BMI_m=.
Hgb_m=. Anemia_m=. _ERROR_=1 _N_=26
NOTE: Invalid data for Date in line 27 22-31.
27 1ZZ6 7 1 45712514/06/2015013
Line=1 Country=ZZ6 Cluster=7 House_hn=1 Househ_s=0.457125 Date=. Bank_A=0 FHMSIH=1 Geo_zone=3 BMI_w=. Hgb_w=. Anemia_w=. BMI_m=.
Hgb_m=. Anemia_m=. _ERROR_=1 _N_=27
NOTE: Invalid data for Date in line 29 22-31.
29 2ZZ6 8 5 79835716/08/201501322811143
Line=2 Country=ZZ6 Cluster=8 House_hn=5 Househ_s=0.798357 Date=. Bank_A=0 FHMSIH=1 Geo_zone=3 BMI_w=2281 Hgb_w=11.4 Anemia_w=3
BMI_m=. Hgb_m=. Anemia_m=. _ERROR_=1 _N_=29
NOTE: Invalid data for Date in line 30 22-31.
30 4ZZ6 8 7 79835716/08/2015013
Line=4 Country=ZZ6 Cluster=8 House_hn=7 Househ_s=0.798357 Date=. Bank_A=0 FHMSIH=1 Geo_zone=3 BMI_w=. Hgb_w=. Anemia_w=. BMI_m=.
Hgb_m=. Anemia_m=. _ERROR_=1 _N_=30
NOTE: Invalid data for Date in line 31 22-31.
31 4ZZ6 8 8 79835716/08/2015013 2396 792
Line=4 Country=ZZ6 Cluster=8 House_hn=8 Househ_s=0.798357 Date=. Bank_A=0 FHMSIH=1 Geo_zone=3 BMI_w=. Hgb_w=. Anemia_w=. BMI_m=2396
Hgb_m=7.9 Anemia_m=2 _ERROR_=1 _N_=31
NOTE: Invalid data for Date in line 32 22-31.
WARNING: Limit set by ERRORS= option reached. Further errors of this type will not be printed.
32 4ZZ6 8 13 79835716/08/2015003
Line=4 Country=ZZ6 Cluster=8 House_hn=13 Househ_s=0.798357 Date=. Bank_A=0 FHMSIH=0 Geo_zone=3 BMI_w=. Hgb_w=. Anemia_w=. BMI_m=.
Hgb_m=. Anemia_m=. _ERROR_=1 _N_=32
NOTE: 678 records were read from the infile '/folders/myfolders/study2/MemberData_RuralHealth.dat'.
The minimum record length was 50.
The maximum record length was 50.
NOTE: The data set WORK.ASSIGMENT has 678 observations and 15 variables.
NOTE: DATA statement used (Total process time):
real time 0.02 seconds
cpu time 0.02 seconds
 
 
94 proc print data= assigment;
95 run;
 
NOTE: There were 678 observations read from the data set WORK.ASSIGMENT.
NOTE: PROCEDURE PRINT used (Total process time):
real time 7.06 seconds
cpu time 7.05 seconds
 
 
96
97 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
109

 

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

To really tell you need to post the log messages using the Insert Code icon on the forum editor.  But it looks like the values it is complaining about are in DMY order instead of the MDY order you told SAS to expect.  There is not any year that has 29 months in it.

NOTE: Invalid data for Date in line 1 22-31.
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0
    1     4ZZ6 1 25 104950229/06/201502219981013

View solution in original post

2 REPLIES 2
Tom
Super User Tom
Super User

To really tell you need to post the log messages using the Insert Code icon on the forum editor.  But it looks like the values it is complaining about are in DMY order instead of the MDY order you told SAS to expect.  There is not any year that has 29 months in it.

NOTE: Invalid data for Date in line 1 22-31.
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0
    1     4ZZ6 1 25 104950229/06/201502219981013
xoxozav_1
Calcite | Level 5

Hello Tom,

That was exactly my problem, I wrote mmddyy instead of ddmmyy.

Thanks to your advice, I have solved my problem.

 

Thank you.

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 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 2 replies
  • 457 views
  • 0 likes
  • 2 in conversation