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