BookmarkSubscribeRSS Feed
jc3992
Pyrite | Level 9
DATA Women500;
  INFILE "&dirdata.Women5000.csv" MISSOVER;
  INPUT Year COMMA4.+1 NAME $18. Nationality :$3. Time TIME8. Status :$2. ;
  Run;
  
  

Hi everyone,

 

It would be highly appreciated if anyone has any ideas about how to read in the "Time" variable correctly,

and let me know why my code above would not work. The raw data set is as below:

 

https://rit0-my.sharepoint.com/:x:/g/personal/jc3992_ad_rit_edu/EWniEBsk9ypFn_QHOQjC7GMB3g9qQqdyQkxe...

 

Thank you!!!

3 REPLIES 3
Tom
Super User Tom
Super User

You forgot the : modifier before the TIME. informat on your INPUT statement.

Also if you really have a CSV file then add the DSD option to the INFILE statement.

Your link doesn't work, and any way why post a link for a TEXT file?  Just copy a few lines of the text file and paste them into the pop-up window that appears when you push the {i} button on the editor menu bar.

jc3992
Pyrite | Level 9

Thank you very much!

 

I've tested the link, and found it worked for me just then.

 

I tried to use column modifier too earlier but as I remembered,

it was not working. I will try that again.

Thank you very much!

I will try to upload the raw data set to my post if I can.

ballardw
Super User

@jc3992 wrote:

Thank you very much!

 

I've tested the link, and found it worked for me just then.

 


SHAREPOINT typically has a number of security features that limit who has access. So likely no one outside of your organization has access.

The issue is most likely that your "time" does not have an hour component. The TIME format expects HH:MM:SS. If this is supposed to be minutes and seconds then you will need to read the value as text and parse out the minutes, seconds and fractions of a second and use the HMS function to create a time.

 

Open a code box with the forum's {I} and paste text:

1994,Claudia Pechstein,GER,7:14.37
1998,Claudia Pechstein,GER,6:59.61,WR
2002,Claudia Pechstein,GER,6:46.91,WR
2006,Clara Hughes,CAN,6:59.07
2010,Martina Sablikova,CZE,6:50.92

The problem is attachments get handled by programs some of us can't control, usually a spreadsheet and once opened in a spreadsheet there is not guarantee the result looks anything like the original CSV text because the spreadsheets make assumptions and convert some values, remove or add quotes and sometimes change text to dates.

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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