BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
ajulio4
Obsidian | Level 7

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>

1 ACCEPTED SOLUTION

Accepted Solutions
SASJedi
SAS Super FREQ

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;

 

 

Check out my Jedi SAS Tricks for SAS Users

View solution in original post

4 REPLIES 4
SASJedi
SAS Super FREQ

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?

Check out my Jedi SAS Tricks for SAS Users
ajulio4
Obsidian | Level 7
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
SASJedi
SAS Super FREQ

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;

 

 

Check out my Jedi SAS Tricks for SAS Users
ajulio4
Obsidian | Level 7

Ok.. Thks so much

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 380 views
  • 3 likes
  • 2 in conversation