Hi everyone,
I´m trying to import a database form a .csv, one of the variables contains the code of a route of public transportation, this code can be numeric or alphanumeric. When importing the database, SAS turns this variable into numeric and each alphanumeric observation is turned to missing value. I tried with proc import and i also tried importing with the option you find in file. I also tried
proc import datafile="E:\Datos_Historicos\Plan_Itinerarios_Historico.csv"
dbms=dlm
out=plan_itinierarios_2017
replace;
delimiter=',';
getnames=no;
DBDSOPTS= "DBTYPE=(var2='CHAR(20)' var7='CHAR(5)')";
run;
But it seems DBDSOPTS doesn't work
How can i correct this?
THANK YOU!
Use proc import as you have. The log will have the code of the data step. Copy that into the editor (remove any line numbers that may appear).
Change the informat for the variable/column from (likely best32. or similar) to $15. or something long enough to read all the characters.
Run the modified program.
Save the modified program especially if you are going to read similar files in the future. Then you change the infile to match the new data and change the name of the output data set.
Use proc import as you have. The log will have the code of the data step. Copy that into the editor (remove any line numbers that may appear).
Change the informat for the variable/column from (likely best32. or similar) to $15. or something long enough to read all the characters.
Run the modified program.
Save the modified program especially if you are going to read similar files in the future. Then you change the infile to match the new data and change the name of the output data set.
I didn´t quite get it, I run the proc import, then i use
data WORK.PLAN_ITINIERARIOS_2017 ;
informat var7 $10.;
run;
what do I do next?
sorry!
If you search this forum for posts relating to Import Error or Import Problem you will find a large number of them are from using Proc Import without understaning the limitations and advantages.
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 the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.