BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi,

I'm trying to import a text file where some of the records for a variable are more than 700 characters long.
Proc import procedure is setting a length of 500 for that variable and my output dataset has those records being cut-off at 500th character.

Is there any way to solve this without adding a data step to the proc import??

Thanks in advance
4 REPLIES 4
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Depending on your SAS version, there is a GUESSINGROWS= option, if you want SAS to interrogate more than the default number of rows. The SAS support website http://support.sas.com/ has product DOC and technical paper resources, and a SEARCH facility to find topic related info. I have provided a few links below to related items from the support site.

Scott Barry
SBBWorks, Inc.


http://support.sas.com/kb/1/075.html


http://www2.sas.com/proceedings/sugi30/038-30.pdf
deleted_user
Not applicable
Dear Scott,

Thanks a lot for the reply..

I used the option GUESSINGROWS=50 (my dataset has only 25 observations),
but it didn't work out.

I used the following code that was generated by PROC IMPORT:

data TS ;
2269 %let _EFIERR_ = 0; /* set the ERROR detection macro variable */
2270 infile 'P:\DVL_0865\Mapping\1160_0025\Trial_design_1160-0025.txt' delimiter='09'x MISSOVER DSD lrecl=32767 firstobs=2 ;
2271 informat STUDYID $9. ;
2272 informat DOMAIN $2. ;
2273 informat TSSEQ best32. ;
2274 informat TSPARMCD $10. ;
2275 informat TSPARM $46. ;
2276 informat TSVAL $500. ;
2277 format STUDYID $9. ;
2278 format DOMAIN $2. ;
2279 format TSSEQ best12. ;
2280 format TSPARMCD $10. ;
2281 format TSPARM $46. ;
2282 format TSVAL $500. ;
2283 input
2284 STUDYID $
2285 DOMAIN $
2286 TSSEQ
2287 TSPARMCD $
2288 TSPARM $
2289 TSVAL $
2290 ;
2291 if _ERROR_ then call symputx('_EFIERR_',1); /* set ERROR detection macro variable */
2292 run;

For the variable TSVAL , I need the length to be 700.
I've copied the above program and changed the format and informat for TSVAL and it worked..

Is there any way that I can do this in PROC IMPORT STEP without adding the datastep. This is beacause, we are using the proc import step in a macro and we didn't want to have the set of variables that are in the data step.

Thanks a lot
Peter_C
Rhodochrosite | Level 12
sorry,
I think the short answer is
No

It's not a feature of proc import from a text file.

If you have predictable problems like that 500/700, then you probably have enough information to define the max column lengths and any special informats to be used like dates. With that information your macro needs only define which layout type is relevant and apply that.

good Luck

PeterC
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Honestly, I would consider this to be a limit/defect for PROC IMPORT -- one that you may want to pursue with SAS Tech Support by opening a track. At least get it logged with them that you are dissatisfied with the PROC IMPORT handling of column data greater than 500 characters.

Scott Barry
SBBWorks, Inc.

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
  • 4 replies
  • 1073 views
  • 0 likes
  • 3 in conversation