BookmarkSubscribeRSS Feed
Liliya95
Fluorite | Level 6
Hello!
Please,help,  how can I write a number in the column name when creating the tap_table repository?
I need to create a table where the first column is called payment, and the rest have a name - numbers from 1 to 30.
All fields are of type float.

The code below indicates how the recording occurs.
but there is an error in the line payments.add_column (i_column_char, 'float');
It does not allow you to write a number as a name. How to write it down correctly?

Convert a number to varchar type. Did not help.
The translation was written as dcl varchar i_column_char; i_column_char= put(i_column ,4.0); 
 
 
method execute(varchar(50) AppId,double RtdmId, varchar(50) NaturalPersonID, double CreID, in_out double incomeBKI_out, in_out package tap_table payments);  

 

dcl int i_column interval_out; 

dcl varchar i_column_char; 

i_column=1;  

 

payments.add_column('payment','float'); 

do while (i_column <= 30);  

payments.add_column(i_column_char,'float'); 

i_column=i_colimn+1; 

end;  

 

end;

 
5 REPLIES 5
Liliya95
Fluorite | Level 6
so, I can't pass a variable to the column name?
Liliya95
Fluorite | Level 6
when I write

dcl varchar name;
name='one';
tap_table.add_column(name,'float');

I have error. Why?
name contains character
Liliya95
Fluorite | Level 6
Work!
Thanks!

i_column=1;
_column_char='_payment';

payments.add_column('payment','float');
payments.add_column(_column_char,'float');
payments.add_column('payment'||i_column,'float');


my logs:
payment payment
payment _payment
payment payment1

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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