DATA Step, Macro, Functions and more

Reading Raw Data File with Column Headings

Reply
SAS Employee
Posts: 18

Reading Raw Data File with Column Headings

Hi,

If my raw data file (csv or fixed length file) contains column headings in the first row, can I use a infile, input statement to read in the column headings as my sas variable names?

Thanks!
Trusted Advisor
Posts: 2,115

Re: Reading Raw Data File with Column Headings

Posted in reply to huikeng_sas
You can in EGuide. I'm not sure if it is easy to do in base SAS.
Super Contributor
Super Contributor
Posts: 3,174

Re: Reading Raw Data File with Column Headings

Posted in reply to huikeng_sas
What OS is SAS running under - can you use PROC IMPORT?

Scott Barry
SBBWorks, Inc.
SAS Employee
Posts: 18

Re: Reading Raw Data File with Column Headings

If customer didnt license Acc to PC File Formats, he will not be able to use proc import. So, is there a way that he can work around using infile, input statements without specifying the column names in the input statements?

Thanks!
Valued Guide
Posts: 2,177

Re: Reading Raw Data File with Column Headings

Posted in reply to huikeng_sas
Nicole

except on zOS MVS-type mainframes

for a raw file, the SAS EFI accessed on the main SAS File-menu option Import-Data (aka "Import wizard" which uses proc import when needed) can help, even without licensing SAS/ACCESS to PC file formats.
I prefer a data step (simple example at http://support.sas.com/forums/thread.jspa?messageID=13449㒉 ), but you get more support and prompting from EFI.

If you need prompt support, SAS Enterprise Guide is even better. See that forum at http://support.sas.com/forums/forum.jspa?forumID=10 .

Because of the restrictions that apply to variable names, I don't dynamically load these names, just paste the list from the file into my program and use the editor to "clean up" the problems

PeterC Message was edited by: Peter.C (who forgot not all platforms have SAS EFI and proc import)
Ask a Question
Discussion stats
  • 4 replies
  • 340 views
  • 0 likes
  • 4 in conversation