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 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1877 views
  • 2 likes
  • 5 in conversation