SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

How to change the name and format of PROC IMPORT variables

Reply
Frequent Contributor
Posts: 89

How to change the name and format of PROC IMPORT variables

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.

Regular Contributor
Posts: 151

Re: How to change the name and format of PROC IMPORT variables

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

Ask a Question
Discussion stats
  • 1 reply
  • 240 views
  • 3 likes
  • 2 in conversation