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

Hello:

 

I am having a problem to input the text file,  the sample data is shown below.   

 

id,site,provider,hospital,scr,abi,dein,caseid,date,dob,admitdate,admittime,years,months,days,insurance,sex,race1,race2,race3,race4,race5,race6,hisp,zipcode,county,symptom1,scrsymptom2,scrsymptom3,scrsymptom4,scrsymptom5,scrsymptom6,scrsymptom7,scrsymptom8,scrsymptom9,scrsymptom10,scrsymptom11,exclusion1,exclusion2,exclusion3,exclusion4,exclusion5,exclusion6,exclusion7,exclusion8,exclusion9,exclusion10,elig,consent1,consent2,consent,interview,complete
1,0,1,8,PMS,HK,SHM,WH3T87601,10/05/16,01/30/05,09/05/07,14:10:30,9,159,4562,1,6,5,,,,,,2,55661,Right,4,,,,,,,,,,,,,,,,,,,,,1,,,2,0,1
2,0,2,8,OLS,MLB,FCN,QF2B64352,2014-12-03,2014-12-03,2014-06-03, 09:53:45,3,25,506,1,1,8,,,,,,1,69456,Wrong,1,,,,,,,,,,,,,,,,,,,,,8,,,2,4,6

 

I found out when I created my codes below, it didn't work.  Starting with column "admitdate", the date is missing.   Please help.  Thanks.

 

data test;
	infile "Pathway/test.txt" dlm=',' dsd missover lrecl=47 firstobs=2;
     input
             id   $
site   
provider   
hospital   
scr   $
abi   $
dein   $
caseid   $
date   $
dob   $
admitdate   $
admittime   $
years   
months   
days   
insurance   
sex   
race1   
race2   
race3   
race4   
race5   
race6   
hisp   
zipcode   
county   $
symptom1   
scrsymptom2   
scrsymptom3   
scrsymptom4   
scrsymptom5   
scrsymptom6   
scrsymptom7   
scrsymptom8   
scrsymptom9   
scrsymptom10   
scrsymptom11   $
exclusion1   
exclusion2   
exclusion3   
exclusion4   
exclusion5   
exclusion6   
exclusion7   
exclusion8   
exclusion9   
exclusion10   $
elig   
consent1   $
consent2   $
consent   
interview   
complete;
run;

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

This is way too small:

 

lrecl=47

 

It specifies the number of characters that SAS will read from each incoming line.  Pick a wide enough value, perhaps:

 

lrecl=300

View solution in original post

4 REPLIES 4
Astounding
PROC Star

This is way too small:

 

lrecl=47

 

It specifies the number of characters that SAS will read from each incoming line.  Pick a wide enough value, perhaps:

 

lrecl=300

ybz12003
Rhodochrosite | Level 12

Thanks, it works.

ballardw
Super User

I strongly suggest reading Date values with a DATE informat and Times with a time informat. You can do a lot more with actual SAS Date and time values than character. Almost anything, including sorting, with character values as you show will require conversion to a date or headaches with multiple additional steps to get the values you want.

I suggest reading those dates with MMDDYY8. informat and the time with time8.

Assign an appropriate display format for people to use.

ybz12003
Rhodochrosite | Level 12

Thanks, but date9. won't work on 2014-03-06.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 598 views
  • 0 likes
  • 3 in conversation