Dear All,
I am infant to SAS and this is my first post on SAS ,
Uploaded CSV file to one of my folder and also able to read the data from csv file .,But I would like to get all the columns of CSV file .Can any one help me how can I do it
data tableau; infile '/folders/myfolders/DataFiles/SuperstoreSales.csv' delimiter=',' firstobs=2 ; input RowID OrderID Order Date$ Profit$; run; proc print data=tableau; run;
Hi
Why not use Proc IMPORT, like so
proc import
file="/folders/myfolders/DataFiles/SuperstoreSales.csv"
out=tableau
dbms=csv
replace
;
run;
Bruno
How many columns do you have in the csv file?
According to your INPUT statement you get at most 5 colums.
If there are more - assign names and informats to the other columns too.
Hi
Why not use Proc IMPORT, like so
proc import
file="/folders/myfolders/DataFiles/SuperstoreSales.csv"
out=tableau
dbms=csv
replace
;
run;
Bruno
Do bear in mind that with the simplicity of proc import, you do lose the fine grained control you had with the datastep. For simple tasks proc import may work, but under the hood what it is doing is scanning the file and guessing what the best way to read data in. It may/may not get this right (causing you further work), and it may not do the same thing if the data changes in any way. Once you move from simple tasks I would really advise that you put a bit more effort into the import, write the datastep yourself (you can take the output from proc import which will be in the log and modify that to your needs), this way you know exactly how the data will import each time.
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.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.