BookmarkSubscribeRSS Feed
Tri_Luong
Obsidian | Level 7

Dear all,


I am trying to write a code with Proc Import to import a *.txt file, in which there is a variable containing "card numbers" (field name: [T:L:100]CARD_NO) with 16 digits. However, after importing, the values showed in the variable are numeric as "4.69672E15". Please help to instructing me to:

 

PROC IMPORT OUT= WORK.PORTFOLIO_TODAY
DATAFILE="&rprt_cust_info.CC Customer Info &RPRT_TODAY..TXT"
DBMS=DLM REPLACE;
GETNAMES=YES;
GUESSINGROWS=10000;
DELIMITER="09"X;
RUN;

 

1/ Keep the format of the variable as "character" when importing instead of changing the format with "data steps" after the importing.

or

2/ Import all the variable as "character" format.

 

Thank you so much.

It is never late for learning.
2 REPLIES 2
Reeza
Super User
Use a data step instead. Proc import doesn’t give you control of the variables length or type.
You can find the starter code in your log after running import and use that, modified to account for the character variable of course.
andreas_lds
Jade | Level 19

As @Reeza already explained how to solve the problem, i'd like to add one thing: switch of caps-lock when writing code. All those uppercase chars reduce readability.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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