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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.