BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
andy_wk
Calcite | Level 5

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.

1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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;

View solution in original post

3 REPLIES 3
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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;

andy_wk
Calcite | Level 5

Thanks RW9. It is working great.

ballardw
Super User

Your DLM=TAB says it expects the data to be tab delimited. Are you sure the data has TABS?

sas-innovate-2024.png

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.

 

Register now!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1107 views
  • 0 likes
  • 3 in conversation