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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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