I've got the following file I'm trying to import
namq_aux_lp 07.07.2014
namq_aux_ulc 08.07.2014
namq_aux_gph 07.07.2014
prc_hicp_cann 17.07.2014
namq_nace10_k 02.07.2014
sei_bsco_m 10.06.2014
ei_bsin_m_r2 26.06.2014
lassei_bsbu_m_r2 26.06.2014
assei_bsrt_m_r2 26.06.2014
ei_bssi_m_r2 26.06.2014
ei_bsse_m_r2 26.06.2014
ei_bsci_m_r2 26.06.2014
sts_trtu_m 17.07.2014
I've used the following proc import's
proc import out=lesdates datafile="C:\work\studies\project\data\calend\bigfilev2.txt" dbms=tab REPLACE; getnames=no; run;
proc import out=lesdates datafile="C:\travail\etudes\projetpib\donnees\calend\bigfilev2.txt" dbms=tab REPLACE; delimiter='09'x; getnames=no; run;
But each time, instead of having 2 variables, I'm ending with one variable taking the 2 columns
var1
------------------------------
namq_aux_lp 07.07.2014
namq_aux_ulc 08.07.2014
namq_aux_gph 07.07.2014
prc_hicp_cann 17.07.2014
namq_nace10_k 02.07.2014
sei_bsco_m 10.06.2014
ei_bsin_m_r2 26.06.2014
lassei_bsbu_m_r2 26.06.2014
assei_bsrt_m_r2 26.06.2014
ei_bssi_m_r2 26.06.2014
ei_bsse_m_r2 26.06.2014
ei_bsci_m_r2 26.06.2014
sts_trtu_m 17.07.2014
What am I doing wrong???
PS: I can edit the text file but I would like to do the import without touching anything.
Is the delimiter matching what is between the two text's? Open with a hex editor and check it, it maybe that that gap is spaces or something. I would personally go with a specified delimiter, e.g. pipe/comma etc. so its clear, I really don't like non-printable characters.
You could try the datastep version:
data want;
attrib some_text format=$200. adate informat=ddmmyy10. format=ddyymm10.;
infile "...\yourfile.txt" dlm='09'x;
input...
run;
Is the delimiter matching what is between the two text's? Open with a hex editor and check it, it maybe that that gap is spaces or something. I would personally go with a specified delimiter, e.g. pipe/comma etc. so its clear, I really don't like non-printable characters.
You could try the datastep version:
data want;
attrib some_text format=$200. adate informat=ddmmyy10. format=ddyymm10.;
infile "...\yourfile.txt" dlm='09'x;
input...
run;
Thanks RW9. It is working great.
Your DLM=TAB says it expects the data to be tab delimited. Are you sure the data has TABS?
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.