- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Good afternoon
I have a stored process which has a dropdown list that feeds off a table and displays one question at a time.
I need to put a text box next to the drop down, but cannot get it to work properly. The drop down list displays on top instead of inside the drop down space (see image attached).
My original Code:
data _null_;
file _webout;
set onequestion_&i end=eof;
by Drop_Down_Selection;
if _n_=1 and Drop_Down_Selection not in ('Free text') then do;
put '<tr><td><table border=1 width=100%>';
put '<td class="TD2" width=100%>' questions '</td>';
put '<td colspan=1><select style="text-align: right" name="dropdowntp" id="dropdowntp">';
end;
if _n_=1 and Drop_Down_Selection in ('Free text') then do;
put '<tr><td><table border=1 width=100%>';
put '<td class="TD2" width=100%>' questions '</td>';
end;
if first.Drop_Down_Selection and Drop_Down_Selection not= 'Free text' then
if "&answer." = Drop_Down_Selection then
put '<option value="' Drop_Down_Selection '"' Drop_Down_Selection ' selected>' Drop_Down_Selection '</option>';
else
put '<option value="' Drop_Down_Selection '"' Drop_Down_Selection '>' Drop_Down_Selection '</option>';
if first.Drop_Down_Selection and Drop_Down_Selection = 'Free text' then
put '<td><input type="text" id="dropdowntp" name="dropdowntp" value='"&answer."'></td>';
if eof then do;
put '</select></td>';
put '</td></td></table>';
end;
run;
Changed code:
data _null_;
file _webout;
set onequestion_&i end=eof;
by Drop_Down_Selection;
if _n_=1 and Drop_Down_Selection not in ('Free text') then do;
put '<tr><td><table border=2 width=100%>';
put '<td class="TD2" width=100%>' questions '</td>';
put '<td colspan=1><select style="text-align: right" name="dropdowntp" id="dropdowntp">';
put '<td><input type="text" id="dropdownmul" name="dropdownmul" value='"&answer."'><tr></td>';
end;
if _n_=1 and Drop_Down_Selection in ('Free text') then do;
put '<tr><td><table border=1 width=100%>';
put '<td class="TD2" width=100%>' questions '</td>';
end;
if first.Drop_Down_Selection and Drop_Down_Selection not= 'Free text' then
if "&answer." = Drop_Down_Selection then do;
put '<td><option value="' Drop_Down_Selection '"' Drop_Down_Selection ' selected>' Drop_Down_Selection '</option>';
put '<input type="text" id="dropdownmul" name="dropdownmul" value='"thisone"'></td>';
end;
else do;
put '<option value="' Drop_Down_Selection '"' Drop_Down_Selection '>' Drop_Down_Selection '</option>';
end;
if first.Drop_Down_Selection and Drop_Down_Selection = 'Free text' then
put '<td><input type="text" id="dropdowntp" name="dropdowntp" value='"&answer."'></td>';
if eof then do;
put '</select></td>';
put '</td></td></table>';
end;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Sorry, your question is not clear at all.
Can you provide an example onequestion_&i dataset in the form of a data step (you can use the data2datastep macro linked at https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/).
Based on this example can you explain how the generated HTML differs from what you expects ?
Also, dont attach excel files to your question as many readers can't or won't open them. Use the camera icon to insert a picture instead.