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?
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.