BookmarkSubscribeRSS Feed
belboy
Obsidian | Level 7

HI,

I'm using the import wizard with SAS to import a MS Excel CSV file.  The problem is that SAS imports the entire file as a header with no observations.

 

For example,

SAS shows a 10 variable dataset with 0 observations:

RSID  FULLNAME  Priv  Date  EMAIL  Ugkdd10  Jason Thomas  DBA  2008  jt@hotmail.com

 

I need SAS to show me a 5 variable dataset with 1 observation:

RSID,           FULLNAME,         Priv,     Date,       EMAIL

Ugkdd10      Jason Thomas      DBA     2008        jt@hotmail.com

 

I couldn't find any documentation of how to do this.  Maybe proc transpose with some other formula?

 

Do I need to figure out a way to recreate the dataset with SAS code (i.e., SCAN, SUBSTR, etc)?

 

Any help is very much appreciated.

5 REPLIES 5
Tom
Super User Tom
Super User

I bet you are using Excel on a MAC?

Excel is too stupid to understand that Mac's are now using Unix and that text files should use linefeed as the end of line marker and not carriage return.

Either use the SAVE AS feature and pick a different file format that uses the right end of line markers.

Or tell SAS that the end of line marker is CR.

filename mycsv 'filename' termstr=cr;
belboy
Obsidian | Level 7

Nah, not a Mac.  Using proc import wizard via Windows PC.

SASKiwi
PROC Star

Try another FILE SAVE AS CSV making sure you just choose the plain CSV option  and not CSV (MAC).

SuryaKiran
Meteorite | Level 14

Make sure you saved the right CSV file. If you save your file as CSV(Macintosh) and try to import it into SAS then you will have the records in a single line.

@Tom You maybe right they maybe saved as Mac files.

Test.png

 

 

 

 

 

 

Thanks,
Suryakiran
Cynthia_sas
SAS Super FREQ

Hi:

  One possible solution has also been posted here: https://communities.sas.com/t5/SAS-Procedures/SAS-import-entire-file-as-a-header-how-do-I-resolve/m-... in your other posting on the same question.

Cynthia

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
  • 5 replies
  • 1390 views
  • 2 likes
  • 5 in conversation