BookmarkSubscribeRSS Feed
santhosh
Fluorite | Level 6

I am using proc export .txt files with delimiter '|'

while importing this .txt files i am getting missing  values for some  columns

i am unable to get allvalues almost i am exporting 40 columns and importing them

6 REPLIES 6
art297
Opal | Level 21

You will have to show some example data and the code you are using to export and import.

santhosh
Fluorite | Level 6

This is sample code iam using

proc export data=sample;
outfile="path/sample.txt"
dbms=dlm replace;
delimiter='|';
run;


data sample;
infile "path/sample.txt" firstobs=2
dlm='|' dsd missover;
attrib ACODE length=$7. informat=$7. format=$7.;
attrib X_PRD informat=anydtdte32. format=MMDDYY10.;
attrib I_NO length=$10. informat=$10. format=$10.;
attrib EI_SYS length=$3. informat=$3. format=$3.;
attrib S_PORTCODE length=$10. informat=$10. format=$10.;
attrib S_BILLNO length=$10. informat=$10. format=$10.;
attrib EXP_DT informat=anydtdte32. format=MMDDYY10.;
attrib DUE_DT informat=anydtdte32. format=MMDDYY10.;
attrib EXTN_GR length=$1. informat=$1. format=$1.;
attrib EXTN_AUTHO length=$4. informat=$4. format=$4.;
attrib EXTN_DT informat=anydtdte32. format=MMDDYY10.;
attrib ADCODE length=$7. informat=$7. format=$7.;
attrib REALISE length=$1. informat=$1. format=$1.;
attrib REALISE_DT informat=anydtdte32. format=MMDDYY10.;
attrib REMARK length=$35. informat=$35. format=$35.;


input  ACODE X_PRD I_NO EI_SYS BILL_NO BILL_DT
STATUS_H EXP_NAME EXP_ADDR1 EXP_ADDR2 EXP_CITY EXP_PIN S_PORT
S_PORTCODE S_BILLNO EXP_DT   DUE_DT EXTN_GR
EXTN_AUTHO EXTN_DT EXP_CTRY EXP_COMM INV_CUR INV_AMT INV_INR
R_CURR R_AMT OS_AMT OSB_NAME OSB_ADDR1 OSB_ADDR2 OSB_CTRY
OSB_PIN REALISE REALISE_DT REMARK ;
run;

I am declearing all column attribs which mentioned in input statement

in output i am getting missing date columns and some numeric columns

art297
Opal | Level 21

What do your dates actually look like?  I can't imagine a date that would take up 32 columns.  Are you possibly trying to read in datetime fields?

santhosh
Fluorite | Level 6

Date format is 31DEC2011:00:00:00

and by applying attribs i am converting into MMDDYY10.

art297
Opal | Level 21

I just noticed that your post never received an answer.  Your dates aren't dates, they are datetimes.

Try replacing the anydtdte32. with andtdtm32. and see if that corrects the problem.

ballardw
Super User

You might want to add a LRECL= 32767 parameter on your INFILE statement (probably doesn't have to be as big as 32767 but that provides room for lots of difference in columns). The lengths of the variables with attributes listed totals to 248 columns and the added numerics are likely pushing it over the default 256 columns.

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