<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: In a Stored Process, using _webout and &amp;lt;select&amp;gt; statement how do I call variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/In-a-Stored-Process-using-webout-and-lt-select-gt-statement-how/m-p/563321#M157906</link>
    <description>&lt;P&gt;Thank you for your response. I am not sure that we are talking about the same thing. . .&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dropdown issue.jpg" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29975i7F5FC0ABAFABC7FD/image-size/large?v=v2&amp;amp;px=999" role="button" title="dropdown issue.jpg" alt="dropdown issue.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 03 Jun 2019 16:21:58 GMT</pubDate>
    <dc:creator>cuevasj</dc:creator>
    <dc:date>2019-06-03T16:21:58Z</dc:date>
    <item>
      <title>In a Stored Process, using _webout and &lt;select&gt; statement how do I call variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/In-a-Stored-Process-using-webout-and-lt-select-gt-statement-how/m-p/563258#M157881</link>
      <description>&lt;P&gt;What I am trying to do is use a _webout session to create a dropdown that is populated with school name&amp;nbsp; and number, then later I need to populate a student list base off of that school number. My issue is that I don't know how to call a variable ( in my code schoolNo ) to a proc sort statement that will populate the student names.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* here is where I get my school number and school name to populate the first dropdown */&lt;/P&gt;&lt;P&gt;data schools(keep=school_number school_name seq);&lt;BR /&gt;set whse.school_dim;&lt;BR /&gt;where substr(school_number,1,1) ~in ('',' ','3','8','9','A','C','D','N','P','U','Z')&lt;BR /&gt;and substr(school_name_number,1,1) ne 'Z'&lt;BR /&gt;and current_ind=1;&lt;BR /&gt;if substr(school_name_number,1,1)='C' then seq=9; else&lt;BR /&gt;seq=1;&lt;BR /&gt;run;&lt;BR /&gt;proc sort data=work.schools out=school(drop=seq); by seq school_name; run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%let stpname=/DCPS Departments/Quick Reports/Stored Processes/Quick Reports sp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;data _null_;&lt;BR /&gt;format infile $char256.;&lt;BR /&gt;input;&lt;BR /&gt;infile = resolve(_infile_);&lt;BR /&gt;file _webout;&lt;BR /&gt;put infile;&lt;BR /&gt;datalines4;&lt;BR /&gt;&amp;lt;HTML&amp;gt;&lt;BR /&gt;&amp;lt;head&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;...code here...&lt;BR /&gt;&lt;BR /&gt;&amp;lt;div&amp;gt;&amp;lt;strong&amp;gt;Select a School:&amp;lt;/strong&amp;gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;SELECT id="schoolNo" onchange="setSchoolNo()" class="drpdowngreen"&amp;gt;&lt;BR /&gt;;;;;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;data _null_;&lt;BR /&gt;set work.school;&lt;BR /&gt;file _webout;&lt;BR /&gt;put '&amp;lt;OPTION VALUE=' School_Number '&amp;gt;' school_number School_Name '&amp;lt;/option&amp;gt;';&lt;BR /&gt;;;;;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;data _null_;&lt;BR /&gt;format infile $char256.;&lt;BR /&gt;input;&lt;BR /&gt;infile = resolve(_infile_);&lt;BR /&gt;file _webout;&lt;BR /&gt;put infile;&lt;BR /&gt;datalines4;&lt;BR /&gt;&amp;lt;/SELECT&amp;gt;&lt;BR /&gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;... bunch of code followed by the select that I want to be populated by the school&amp;nbsp; chosen in the select above ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;select name="studentscorecard"&amp;gt;Score Card by Student:&lt;BR /&gt;;;;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sort&lt;BR /&gt;data=mart.student_demographics(keep=dcps_student_id student_full_name school_number where=(school_number= "&amp;amp;schoolNo." )) nodupkey&lt;BR /&gt;out=student_list;&lt;BR /&gt;by student_full_name;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;set work.student_list;&lt;BR /&gt;file _webout;&lt;BR /&gt;put '&amp;lt;OPTION VALUE=' dcps_student_id '&amp;gt;' student_full_name '&amp;lt;/option&amp;gt;';&lt;BR /&gt;;;;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;... more code here to close out everything ...&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;lt;td&amp;gt;&lt;BR /&gt;&amp;lt;input type="submit" value="Generate Excel File" class="generate_report" style="font-weight: bold; font-size: 20px"&amp;gt;&lt;BR /&gt;&amp;lt;/td&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jun 2019 14:39:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/In-a-Stored-Process-using-webout-and-lt-select-gt-statement-how/m-p/563258#M157881</guid>
      <dc:creator>cuevasj</dc:creator>
      <dc:date>2019-06-03T14:39:56Z</dc:date>
    </item>
    <item>
      <title>Re: In a Stored Process, using _webout and &lt;select&gt; statement how do I call variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/In-a-Stored-Process-using-webout-and-lt-select-gt-statement-how/m-p/563262#M157882</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please post a minimal code that replicates your problem in order to avoid distracting&lt;/P&gt;
&lt;P&gt;the reader with unnecessary details.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I did not read all your code but i see that your select tag lacks a name in order for its value to be sent to the server.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For instance if you use the tag&lt;/P&gt;
&lt;P&gt;&amp;lt;SELECT id="schoolNo" name="schoolNo" onchange="setSchoolNo()" class="drpdowngreen"&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the selected value will be sent to the server wich can retrieve it through the macro variable &amp;amp;schoolNo.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jun 2019 14:21:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/In-a-Stored-Process-using-webout-and-lt-select-gt-statement-how/m-p/563262#M157882</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2019-06-03T14:21:47Z</dc:date>
    </item>
    <item>
      <title>Re: In a Stored Process, using _webout and &lt;select&gt; statement how do I call variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/In-a-Stored-Process-using-webout-and-lt-select-gt-statement-how/m-p/563263#M157883</link>
      <description>&lt;P&gt;I appologize for the code. The last time I posted I was told that I didn't have enough code. Guess I either have to stop posting or try to figure out what the sweet spot is.&lt;BR /&gt;&lt;BR /&gt;Either way, thank you for your response, however the "&amp;amp;schoolNo." does not correctly populate my proc sort.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jun 2019 14:27:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/In-a-Stored-Process-using-webout-and-lt-select-gt-statement-how/m-p/563263#M157883</guid>
      <dc:creator>cuevasj</dc:creator>
      <dc:date>2019-06-03T14:27:39Z</dc:date>
    </item>
    <item>
      <title>Re: In a Stored Process, using _webout and &lt;select&gt; statement how do I call variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/In-a-Stored-Process-using-webout-and-lt-select-gt-statement-how/m-p/563285#M157891</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;here is a simple code that sends the value from a select to the server and displays it :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input values;
cards;
1
2
3
4
5 
;
run;

%macro main;
    %global sasval;

    data _NULL_;
        file _webout;
        put "&amp;lt;html&amp;gt;&amp;lt;body&amp;gt;&amp;lt;form method='post' action='&amp;amp;path_to_stp.'&amp;gt;";


        %if &amp;amp;sasval.ne %then %do;
            put "&amp;lt;p&amp;gt;Current value &amp;amp;sasval.&amp;lt;/p&amp;gt;";
        %end;

        put "&amp;lt;select name='sasval'&amp;gt;";
        do until (eof);
            set have end=eof;
            put "&amp;lt;option value='" values+(-1) "'&amp;gt;" values+(-1) "&amp;lt;/option&amp;gt;";
        end;
        put "&amp;lt;/select&amp;gt;";
        put "&amp;lt;button type='submit'&amp;gt;OK&amp;lt;/button&amp;gt;";
        put '&amp;lt;/form&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;';

        stop;
    run;

%mend;

%main;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The same stored process is used for displaying the select and the selected value after validation.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jun 2019 15:11:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/In-a-Stored-Process-using-webout-and-lt-select-gt-statement-how/m-p/563285#M157891</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2019-06-03T15:11:11Z</dc:date>
    </item>
    <item>
      <title>Re: In a Stored Process, using _webout and &lt;select&gt; statement how do I call variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/In-a-Stored-Process-using-webout-and-lt-select-gt-statement-how/m-p/563321#M157906</link>
      <description>&lt;P&gt;Thank you for your response. I am not sure that we are talking about the same thing. . .&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dropdown issue.jpg" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29975i7F5FC0ABAFABC7FD/image-size/large?v=v2&amp;amp;px=999" role="button" title="dropdown issue.jpg" alt="dropdown issue.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jun 2019 16:21:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/In-a-Stored-Process-using-webout-and-lt-select-gt-statement-how/m-p/563321#M157906</guid>
      <dc:creator>cuevasj</dc:creator>
      <dc:date>2019-06-03T16:21:58Z</dc:date>
    </item>
    <item>
      <title>Re: In a Stored Process, using _webout and &lt;select&gt; statement how do I call variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/In-a-Stored-Process-using-webout-and-lt-select-gt-statement-how/m-p/563469#M157973</link>
      <description>&lt;P&gt;Something like this ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data schools;
    input id school $;
    cards;
1 School1
2 School2
3 School3
4 School4
5 School5
;
run;

data students;
    input idSch idStud student $;
    cards;
1 1 Smith
1 2 Jones
2 1 Brown
2 2 Davis
3 1 King
3 2 Young
4 1 Hill
4 2 Lee
5 1 White
5 2 Baker
;
run;

%macro display_form;

    data _NULL_;
        file _webout;

        put "&amp;lt;html&amp;gt;&amp;lt;body&amp;gt;&amp;lt;form method='post''&amp;gt;";

        put "&amp;lt;select id='schoolNo' name='schoolNo' onchange='retrieveStuds()'&amp;gt;";
        put "&amp;lt;option disabled selected&amp;gt;-- Choose a school --&amp;lt;/option&amp;gt;";
        do until (eof);
            set schools end=eof;
            put "&amp;lt;option value='" id+(-1) "'&amp;gt;" school+(-1) "&amp;lt;/option&amp;gt;";
        end;
        put "&amp;lt;/select&amp;gt;&amp;lt;br&amp;gt;";
        put "&amp;lt;select id='studNo'&amp;gt;"
        put "&amp;lt;option disabled selected&amp;gt;-- Choose a student --&amp;lt;/option&amp;gt;";
        put "&amp;lt;/select&amp;gt;&amp;lt;br&amp;gt;";

        put "&amp;lt;script src='https://code.jquery.com/jquery-1.11.3.js'&amp;gt;&amp;lt;/script&amp;gt;";
        put "&amp;lt;script type='text/javascript'&amp;gt;";
        put "function retrieveStuds() {";
        put "    $.ajax({";
        put "        url: window.location.href,";
        put "        type: 'POST',";
        put "        data: '%nrstr(&amp;amp;schoolNo)='+$('#schoolNo').val(),";
        put "        dataType:'json',";
        put "        success: function (data) {";
        put "            $('#studNo option:gt(0)').remove()";
        put "            var arrayStud=data['SASTableData+STUDENTS'];";
        put "            $.each(arrayStud, function() {";
        put "                $('#studNo').append($('&amp;lt;option&amp;gt;').val($(this)[0]['idStud']).html($(this)[0]['student']))";
        put "            })";
        put "        }";
        put "    });";
        put "}";
        put "&amp;lt;/script&amp;gt;";

        put '&amp;lt;/form&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;';

        stop;
    run;

%mend;

%macro main;

    %global schoolNo;

    %if &amp;amp;schoolNo.= %then %do;
        %display_form;
    %end;
    %else %do;

        data _NULL_;    
            rc=appsrv_header('Content-type:','application/json');
        run;

        proc json out=_webout;
            export students (where=(idSch=&amp;amp;schoolNo.));
        run;
    %end;

%mend;

%main;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 04 Jun 2019 08:47:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/In-a-Stored-Process-using-webout-and-lt-select-gt-statement-how/m-p/563469#M157973</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2019-06-04T08:47:55Z</dc:date>
    </item>
    <item>
      <title>Re: In a Stored Process, using _webout and &lt;select&gt; statement how do I call variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/In-a-Stored-Process-using-webout-and-lt-select-gt-statement-how/m-p/563489#M157986</link>
      <description>Exactly like this. Thank You!</description>
      <pubDate>Tue, 04 Jun 2019 11:38:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/In-a-Stored-Process-using-webout-and-lt-select-gt-statement-how/m-p/563489#M157986</guid>
      <dc:creator>cuevasj</dc:creator>
      <dc:date>2019-06-04T11:38:19Z</dc:date>
    </item>
  </channel>
</rss>

