Hello,
I have problem on Viya with something i want to do. Can someone tell mi if its posible and then tell me how i can do it.
am filling my html table with my data.
i have this for example :
data _null_; file _webout; set inputData; put '<tr>'; put '<td class="tabledit-view-mode" style="cursor: pointer;">'; put '<span>' Name; put '</span>'; put '</td>'; put '<td class="tabledit-view-mode" style="cursor: pointer;">'; put '<span >' ??????????????; put '</span>'; put '</td>'; put '<tr>'; run;
My problem is intead of putting ???? i want to put a variable which is too long and i have to display this variable in this way
n=0; do until(n>=countw("columnVar",",")); grp = scan("columnVar",n); put grp; n+1; end;
am lookin for a way to display my variable in the html <td> and </td>
If you want the individual items to display on a new line inside an HTML column, you need to replace the commas (.) with a line break code (<br>). The TRANWRD function can help:
data _null_;
length text $32767;
file _webout;
set inputData;
/* Change all commas to line break tags */
columnVar=tranwrd(columnVar,',','<br>');
put '<tr>';
put '<td class="tabledit-view-mode" style="cursor: pointer;">';
put '<span>' Name;
put '</span>';
put '</td>';
put '<td class="tabledit-view-mode" style="cursor: pointer;">';
put '<span >' text;
put '</span>';
put '</td>';
run;
Max character variable length in SAS is 32,767. Because you are writing an HTML table to the output file, when the file renders in a browser, the text it contains should automatically wrap within the table column for each row. So I'm having difficulty visualizing what you are trying to accomplish with the DO loop. Can you explain a bit more?
for example my variable is this form %let var = ABCD_GROUP,OPEGROU,AWSAMZ,HOMJACGFF,YEDD_DE,UEUEDD,HDHDHD_GGGGG,OPERATOR_DATA,INVOICE_MKG,GRFSDD_MKT,OFFICE_DIREC,AMZ_RECRUIT,ALL_EVENT,REZO_SAS,AHAHEHEHDH_TERR ; and in the Html <td> i want this variaable to be display this way : intead of list form separed by comma : ABCD_GROUP OPEGROU AWSAMZ AWSAMZ HOMJACGFF YEDD_DE UEUEDD HDHDHD_GGGGG OPERATOR_DATA INVOICE_MKG GRFSDD_MKT OFFICE_DIREC AMZ_RECRUIT ALL_EVENT REZO_SAS AHAHEHEHDH_TERR
If you want the individual items to display on a new line inside an HTML column, you need to replace the commas (.) with a line break code (<br>). The TRANWRD function can help:
data _null_;
length text $32767;
file _webout;
set inputData;
/* Change all commas to line break tags */
columnVar=tranwrd(columnVar,',','<br>');
put '<tr>';
put '<td class="tabledit-view-mode" style="cursor: pointer;">';
put '<span>' Name;
put '</span>';
put '</td>';
put '<td class="tabledit-view-mode" style="cursor: pointer;">';
put '<span >' text;
put '</span>';
put '</td>';
run;
Ok.. Thks so much
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.