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.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.