BookmarkSubscribeRSS Feed
TurnTheBacon
Fluorite | Level 6

I've used PROC IMPORT to read a semicolon-delimited CSV-file. 14 variables have been created (VAR1-VAR14). Now I wonder what kind of statements I can use to change the name and format of these variables. This is my code so far:

proc import

  file='foldername/filename.csv'

  out=&_OUTPUT. replace;

  delimiter=";";

  getnames=no;

quit;

P.S. As you can see I had to use getnames=no in the PROC IMPORT, and this cannot be changed.

Thanks for your time, and sorry for the very newbie kind of question.

1 REPLY 1
Keith
Obsidian | Level 7

My preference when importing data files is to use the import wizard first.  This rarely creates a dataset in the exact required format, however if you press F4 from within an editor window, it will recall the data step code used by the wizard.  It is then a simple matter to edit the formats and variable names to achieve your desired result.

Hope this helps.

Keith

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 1756 views
  • 3 likes
  • 2 in conversation