BookmarkSubscribeRSS Feed
rohitkrishna
Calcite | Level 5
Hi, Kurtbremser,
Thanks for the replay
{ya i changed the infile name what i mention above code , but still its a error }
{1 DATA RAM_;
WARNING: The Base Product product with which DATASTEP is associated will expire
installation representative to have it renewed.
2 INFILE karli2a DSD;
3 INPUT
4 @1 TEXT $CHAR60.
5 @61 LS_ADDRESS_ID PIB4.
6 ;
7 LS_ADDRESS_ID = PUT(ADDRESS_ID,12.);
8 RUN;
Character values have been converted to numeric values at the places give
7:18
9 DATA VIG_;
10 SET RAM_;
11 FILE SYSOUT;
12 PUT
13 @1 TEXT $CHAR60.
14 @61 LS_ADDRESS_ID $CHAR12.
+ ________
+ ________
+ ________
48
+ 48
+ 48
ERROR 48-59: The format CHAR was not found or could not be loaded.
+ERROR 48-59: The format CHAR was not found or could not be loaded.
+ERROR 48-59: The format CHAR was not found or could not be loaded.

15 ;
WARNING: Variable LS_ADDRESS_ID has already been defined as numeric. }
thanks & regards
N muralikrishna
Tom
Super User Tom
Super User

Why are you including the DSD option on the INFILE statement when you INPUT statement is using formatted input to read specific columns?  The DSD option is for handling delimited text, not fixed format text.

rohitkrishna
Calcite | Level 5
Hi, Kurtbremser,
Thanks for the replay
sorry for that just now i copeied you're code and it's working and i have small query regarding the output
õUA000000001250545 |
UA000000002009688 | > those are the input Ls_address_id (values) non readble format
þUA000000002009855 | > but while using pib4 i can read the ls_address_id
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
below the results after using pib4 format

LS_ADDRESS_
ID

4042322160 +
4042322160 + > those are the exact results i got by using pib4 format
4042322160 +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
but what is my requirement i need after reading and printing the results i want to print the exact input ls_address_id format it mens {UA000000001250545 }
i want print asties in the input record to output file
so kindly suggest and sorry for the less understanding ( i hope you understood the requirement)
Thanks & regards
N muralikrishna
Kurt_Bremser
Super User

PS the fact that you're working on a computing dinosaur does not mean you must write ugly spaghetti code that hurts the eyes. Proper code formatting is a virtue on every platform.

Astounding
PROC Star

Evidently, this problem is troublesome for you.  So let's simplify the objective.  You're trying to convert LS_ADDRESS_ID to character for printing purposes.  Why bother?  You have a numeric variable that holds the proper values.  SAS knows how to print numeric values.  Why not just use LS_ADDRESS_ID as is?  Just begin with:

 

DATA RAM_;
INFILE karli2a DSD;
INPUT @1 TEXT $CHAR60.
@61 LS_ADDRESS_ID PIB4.;
RUN;

 

When using LS_ADDRESS_ID later, treat it as a numeric variable.  (So use a numeric format when printing, not a character format.)

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 21 replies
  • 1976 views
  • 2 likes
  • 5 in conversation