BookmarkSubscribeRSS Feed
deleted_user
Not applicable
So I imported my csv file into SAS and created a SAS data table. The data table contains the variable name and the values in column format. The problem is I am used to having input statements from a data file and have no clue how to input the data using the data table. The data is messy and looks similar to:

Name Location Date Time

Joe@Johnson Oakland 04/12/2001 04:18:35
Greg@Smith Boston 03/22/2001 06:14:45


I need to seperate name into two seperate columns first and last and then have location and date (total day format) and time (total second format). This data was imported from a .csv file so originally looked like Joe@Johnson,Oakland,04/12/2001/04:18:35 . I tried using informat statements and DLM=',' and DLM='@' statements but have most trouble with the date and time variables. Any help would be appreciated.
1 REPLY 1
LinusH
Tourmaline | Level 20
To read a SAS table, use the SET-statement.
To read out parts of a string which contains a delimiter, use the SCAN function.
To read data and time data, use corresponding informats during input operation, or in the subsequent step by using the input function. See on-line documentation for details.

Regards,
Linus
Data never sleeps

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!
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
  • 1 reply
  • 601 views
  • 0 likes
  • 2 in conversation