Hi All,
I have query on sas mainframe, i want to convert numeric value to character value so kindly help out for the solution
so please find below the sas code and give sum suggestions { and basically my requirement are, ls_address_id variable have binary values like "õUA000000001250545 " , and while reading the input i want it to be in readable format so i gave pib4 . format for that and i got the exact results and it's readable"4042322160" , now "i want to print the results in output file in a non readable format like in input " "õUA000000001250545 " (like that) but while trying to assign $char12. i'm getting error { ls_address_id has already defined has numeric }
so kindly give the solution for that
{
{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
You have been given sufficient advice in https://communities.sas.com/t5/SAS-Programming/SAS-MAINFRAME/m-p/541023 already.
Repeating the identical question with the same mistake won't help if you are not willing to follow our advice.
Your input statement creates a numeric variable. To convert that to character, use the put() function:
LS_ADDRESS_ID = PUT(ADDRESS_ID,12.);
with a numeric output format.
Next, use a character format for printing that:
PUT
@1 TEXT $CHAR60.
@61 LS_ADDRESS_ID $char12.
;
If you want the data to stay the same, then read 4 characters with the $char4. informat and output with the $char4. output format.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.