BookmarkSubscribeRSS Feed
Grandhi4
Calcite | Level 5

Hi All,

How to write a HTML 'form' code for one variable & CSS styles also ?

Thanks,

Suresh

1 REPLY 1
shivas
Pyrite | Level 9

Hi Suresh,

Try this code....Hope it helps.

Create this stored process and then open SAS SPWA and execute and see.

*ProcessBody;

%STPBEGIN;

OPTIONS VALIDVARNAME=ANY;

*  End EG generated code (do not edit this line);

%global category;

ODS LISTING CLOSE;

ods html body=_webout (no_bottom_matter) style=seaside;

ods html close;

proc sql;

  create table test as select distinct name from sashelp.class;

quit;

data _null_;

  file _webout;

  if _n_ = 1 then do;

     thissrv = symget('_url');

     thispgm = symget('_program');

  put '<FORM ACTION="'  thissrv +(-1) '" method=get>';

     put '<input type="hidden" name="_program" value="'

     thispgm +(-1) '">';

end;

  put 'Please Select name:  <select class="button" onchange="submit()" onload="submit()" name="category" style="width=200px" size="1" >';

run;

data _null_;

  file _webout;

  set work.test;

  put "<option value='" name +(-1) "'";

  if ("&category" eq name) THEN put " selected";

  put " >" name +(-1) "</option>";

run;

data _null_;

  file _webout;

  put '</select>';

  put '</form>';

run;

ods html body=_webout (no_top_matter) path=&_tmpcat (url=&_replay) style=seaside;

PROC print DATA=sashelp.class(where=(name="&category"));run;

ods html close;

*  Begin EG generated code (do not edit this line);

;*';*";*/;quit;

%STPEND;

Thanks,

Shiva

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 1 reply
  • 938 views
  • 0 likes
  • 2 in conversation