BookmarkSubscribeRSS Feed
Anand6666
Calcite | Level 5

Hi ,

I am trying to build a SAS report in HTML, where in have text boxes to get the data from the user and save it into a data set and then displayed the saved data from the dataset in another page.

for eg, if I am querying for a particular primary key field from the dataset, if that field exist, then should display all the row details into the corresponding textboxes wherein I have the option to edit.

I am able to get the form details into macro variables using JavaScript and below code:

<script>

put' var mobile = document.getElementById("mobile").value;';

<\script>

to get the value of mobile number entered in html page to the  global macro variable mobile.

But I am unable to perform the reverse.

assign the value of the macro variable into the html textbox element so that I can display the value on the frontend.

I am using the following code but not working yet

<script>

put' document.getElementById("mobile").value="&mobile";';

</script>

it displays  &mobile  in the textbox field.

if I use without the double quotes, sas throws an error that the variable mobile is not defined.

Kindly provide a resolution at the earliest.

Kindly

2 REPLIES 2
Tom
Super User Tom
Super User

SAS does not evaluate macro triggers inside of single quotes.  Use double quotes instead.  Embedded double quotes need to be doubled up.

data _null_;

put " document.getElementById(""mobile"").value=""&mobile"";" ;

...

Anand6666
Calcite | Level 5

Thanks a lot Tom, the resolution worked, also I was able to achieve the same using cards4 format.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 2 replies
  • 2468 views
  • 1 like
  • 2 in conversation