BookmarkSubscribeRSS Feed
rohitkrishna
Calcite | Level 5

Hi All,

I facing some issue with the sas jcl coding

i used to print my ls_addres_id in PIB format (in the input for reading purpose  )

and i want to the output  in $char12 format (for writing purpose )

i tried to convert the pib to char by using INPUT function but unble get the exact results

i'm getting ls_address_id already difined has numeric , plz find below the code

 

DATA RAM_;
INFILE karli2a DSD;
INPUT @1 TEXT $CHAR60.
@61 LS_ADDRESS_ID PIB4.;
LS_ADDRESS_ID = INPUT(ADDRESS_ID,12.);
RUN;
DATA VIG_;
SET RAM_;
FILE SYSOUT;
PUT @1 TEXT $CHAR60.
@61 LS_ADDRESS_ID 12.;
RUN;
PROC PRINT DATA = VIG_; RUN;

WARNING: Variable LS_ADDRESS_ID has already been defined as numeric.
14 RUN;

plz give sum suggestions to find out the results

Thanks & regards 

N muralikrishna

21 REPLIES 21
VRKiwi
Obsidian | Level 7

The message is clear:

ADDRESS_ID is a numeric.

The input function expects a string. Hence the message.

 

> i tried to convert the pib to char by using INPUT function

The put function does that.

 

Also, try to type complete words please (not plz).

 

Astounding
PROC Star
I think you looking for:

ADDRESS_ID = PUT(LS_ADDRESS_ID, 12.);

The results will be right-hand justified, so consider whether it is appropriate to apply the LEFT function as well.
VRKiwi
Obsidian | Level 7

Or, to left-align:

ADDRESS_ID_CHAR = put( LS_ADDRESS_ID, 12. -L );

rohitkrishna
Calcite | Level 5
Hi Vrkiwi,
thanks for the quick reply
i tried those functions what you mention above comment but still i unable to get the results what i expecting
Thnaks & regards
N muralikrishna

rohitkrishna
Calcite | Level 5
Hi Astounding
thanks for the reply i tried the left align but still i not getting what i expecting
basically the input file have 2 fields for the second field ls_address_d has encrypted values like its a hex values so on that scenario i need read it in a pib format and after reding i want to print the output to the encrypted format only so it was suteble to print by using $char12. but while using that format in put statment i'm getting the above warning like ls_address_id has already defined as numeric so how do i get the output what i expecting
thanks & regards
N muralikrishna
Kurt_Bremser
Super User

Take care of which type your variables and values are:

DATA RAM_;
INFILE karli2a DSD;
INPUT
  @1 TEXT $CHAR60.
  @61 ADDRESS_ID PIB4.
;
/* you now have a numeric variable, the values of which were read with a binary format */
LS_ADDRESS_ID = PUT(ADDRESS_ID,12.);
/* the new variable is of type character with a length of 12, and contains a human-readable number */
RUN;

DATA VIG_;
SET RAM_;
FILE SYSOUT;
PUT
  @1 TEXT $CHAR60.
  @61 LS_ADDRESS_ID $char12.
;
/* since LS_ADDRESS_ID is character, use a character format */
RUN;
rohitkrishna
Calcite | Level 5
Hi kurtbremser,
thanks for the replay , i tried what you mention but i geeting the same error
"SET RAM_;
FILE SYSOUT;
PUT
@I_ TEXT $CHAR60.
@61 LS_ADDRESS_ID
WARNING: Variable LS_ADDRESS_ID .
$CHAR12.; . been defined as numeric. has already
ERROR 48-59: The format CHAR was not found or cou ld not be loaded.
ERROR 48-59: The format CHAR was not found or
cou ld not be loaded.
ERROR 48-59: The format CHAR
was not found or cou ld not be loaded. "
sorry for the heavy coding
thanks & regards
n muralikrishhna


Kurt_Bremser
Super User

Please post the log of BOTH steps. Use the {i} button for posting logs, and the "little running man" for code. Both buttons appear when posting in Rich Text.

 

I am asking because my code (first data step) would define LS_ADDRESS_ID as character, while your ERROR implies that it is numeric.

rohitkrishna
Calcite | Level 5
Hi, Kurtbremser,
Thanks for the replay
sorry to say that i'm new to this technology
{WARNING: The Base Product product with which DATASTEP is associated will expire installation representative to have it renewed.
2 INFILE kirlaA DSD;
3 INPUT
4 V1 TEXT $CHAR60.
5 @61 LS_ADDRESS_ID PIB4.;
6 LS_ADDRESS_ID = PUT(ADDRESS_ID,12.);
7 RUN;
NOTE: Character values have been converted to numeric values at the places given 6:18 NOTE: Variable ADDRESS ID is uninitialized.}
Lrecl=27998,Re
{cfm=VB
E: 3 records were read from the infile kirlaA. }
{DATA VIG ; wARnING: The Base Product product with which DATASTEP is associated will expire installation representative to have it renewed.
SET RAM ;
0 FILE SYSOUT;
1 PUT
2 @I_ TEXT $CHAR60.
3 @61 LS_ADDRESS_ID $CHAR12.;
48
waARnING: Variable LS ADDRESS_ID has already been defined as numeric.
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.}
i hope it's fine right, those the errors exactly geeting from my end
please suggest the right format for that
Thanks & regards
N muralikrishna

Kurt_Bremser
Super User

You must be more careful in copying code from here to your environment.

This is the code I gave you:

DATA RAM_;
INFILE karli2a DSD;
INPUT
  @1 TEXT $CHAR60.
  @61 ADDRESS_ID PIB4.
;
/* you now have a numeric variable, the values of which were read with a binary format */
LS_ADDRESS_ID = PUT(ADDRESS_ID,12.);
/* the new variable is of type character with a length of 12, and contains a human-readable number */
RUN;

and this is the corresponding part in your log:

2 INFILE kirlaA DSD;
3 INPUT
4 V1 TEXT $CHAR60.
5 @61 LS_ADDRESS_ID PIB4.;
6 LS_ADDRESS_ID = PUT(ADDRESS_ID,12.);
7 RUN;

Note which variable is read with the pib4. informat.

rohitkrishna
Calcite | Level 5
Hi, Kurtbremser,
Thanks for the replay
ya i missplaced (;)
i ran that after the correction and it shows
{@61 LS_ADDRESS_ID $CHAR12.;
48
waARnING: Variable LS ADDRESS_ID has already been defined as numeric.
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.}
i hope it's fine right, those the errors exactly geeting from my end
please suggest the right format for that
Thanks & regards
N muralikrishna
rohitkrishna
Calcite | Level 5
sorry its ; (semicolon )
Kurt_Bremser
Super User

You really MUST now start to follow our advice. PLEASE (and I mean that!!!!) USE THE {i} BUTTON FOR POSTING LOGS!

And post the WHOLE(!) log from these steps. The snippets you supply are useless for diagnosing what's wrong. Especially since you seem to be typing them off a screen. SAS will never issue a

waARnING:

it's always a

WARNING

!

Just copy/paste the log text. We need to see the truth, the whole truth, and nothing but the truth.

 

Take your time copying code; if possible at all, do a copy/paste from here to your code editor to prevent typos.

rohitkrishna
Calcite | Level 5
Hi, Kurtbremser,
Thanks for the replay
below the exact code in log

{1 DATA RAM_;
WARNING: The Base Product product with which DATASTEP is associated will expire
installation representative to have it renewed.
2 INFILE kerlaA 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

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
  • 1971 views
  • 2 likes
  • 5 in conversation