Hi ,
I am trying to execute the code
data sample;
input @3 tlr_table_name :$30.
tlr_date :yymmdd10.
tlr_time :hhmmss8.
tlr_record_count :6.;
cnt_trl + 1;
call symputx("sox_bsac_cnt",tlr_record_count,g);
run;
when running the code i am getting the below note in the log and points to the call symput line.
NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).
i can clearly see because the variable "tlr_record_count" is numeric and we are assigning it to a macro, sas is doing the conversion and displaying the note. I changed the call symput like below, but i still get the same message.
call symputx("sox_bsac_cnt",put(tlr_record_count,6.),g);
Can you help me understand this why and also let me know how i can overcome this note.
The problem is not with the data you want to put into the macro variable, but with the third argument to call symputx:
call symputx("sox_bsac_cnt",tlr_record_count,g);
g is obviously not a string literal, but a variable name; since this variable is not defined anywhere else, it is created as numeric with a missing value.
You want to specifiy a string literal:
call symputx("sox_bsac_cnt",tlr_record_count,'g');
If you are using call symputx, If value is numeric, SAS converts the value to a character string using the BEST. format and does not issue a note to the SAS log. Leading and trailing blanks are removed, and the resulting character string is assigned to the macro variable. --Reference SAS documentation
Posting some sample data woud help to test.
Try this slight modification 'g' in quotes
call symputx("sox_bsac_cnt",tlr_record_count,'g');
The problem is not with the data you want to put into the macro variable, but with the third argument to call symputx:
call symputx("sox_bsac_cnt",tlr_record_count,g);
g is obviously not a string literal, but a variable name; since this variable is not defined anywhere else, it is created as numeric with a missing value.
You want to specifiy a string literal:
call symputx("sox_bsac_cnt",tlr_record_count,'g');
@Jagadeesh2907 wrote:
Thank you Kurt. I am using call symputx since the third parameter G makes the variable to be in Global table. Is my understanding correct ?
Yes. Just make 'g' a string to make it work.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.