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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 1498 views
  • 3 likes
  • 2 in conversation