<?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: Do ...end error in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Do-end-error/m-p/247976#M46534</link>
    <description>&lt;P&gt;Thank you very much, &amp;nbsp;both solutions from &lt;SPAN class="login-bold"&gt;&lt;U&gt;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462" target="_self"&gt;PGStats&lt;/A&gt;&lt;/U&gt;&amp;nbsp;and &amp;nbsp;&lt;SPAN&gt;&lt;U&gt;&lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;Jagadishkatam &lt;/FONT&gt;&lt;/STRONG&gt;&lt;/U&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;work pretty ! &amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;RW9 , &lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT color="#000000"&gt;I am trying to summary the demographic information.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Thank you again !&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 04 Feb 2016 14:24:01 GMT</pubDate>
    <dc:creator>Ivy</dc:creator>
    <dc:date>2016-02-04T14:24:01Z</dc:date>
    <item>
      <title>Do ...end error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-end-error/m-p/247899#M46509</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to creata a empty data based on the demographic data . &amp;nbsp;In the empty data, there are differnet columm based on the group variable. However, somehow, &amp;nbsp;my " do --end " statements gave me error message. Please see below for the original codes , and log message.&lt;/P&gt;&lt;P&gt;&amp;nbsp;May you help ? Thank you very much.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let indsn = demo ;&lt;BR /&gt;%let by = PCM ;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;select distinct &amp;amp;by into: by_grp separated by " " from &amp;amp;indsn ;&lt;BR /&gt;quit;&lt;BR /&gt;%put &amp;amp;by_grp ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let gr_cnt=%sysfunc(countw(&amp;amp;by_grp));&lt;BR /&gt;%put &amp;amp;gr_cnt;&lt;BR /&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;create table rpt_cat (&lt;BR /&gt;var_level char(50),&lt;BR /&gt;var char(50),&lt;BR /&gt;ptpct char(50),&lt;BR /&gt;rord num,&lt;BR /&gt;%do j = 1 %to &amp;amp;gr_cnt;&lt;BR /&gt;%scan(&amp;amp;by_grp, &amp;amp;j) char(50) ,&lt;BR /&gt;%end;&lt;BR /&gt;pv char(50)&lt;BR /&gt;) ;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;4673 %let indsn = demo ;&lt;BR /&gt;4674 %let by = pcm ;&lt;BR /&gt;4675&lt;BR /&gt;4676&lt;BR /&gt;4677 proc sql;&lt;BR /&gt;4678 select distinct &amp;amp;by into: by_grp separated by " " from &amp;amp;indsn ;&lt;BR /&gt;4679 quit;&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;real time 0.00 seconds&lt;BR /&gt;cpu time 0.00 seconds&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;4680 %put &amp;amp;by_grp ;&lt;BR /&gt;Non-PCM PCM&lt;BR /&gt;4681&lt;BR /&gt;4682 %let gr_cnt=%sysfunc(countw(&amp;amp;by_grp));&lt;BR /&gt;4683 %put &amp;amp;gr_cnt;&lt;BR /&gt;3&lt;BR /&gt;4684&lt;BR /&gt;4685 proc sql;&lt;BR /&gt;4686 create table rpt_cat (&lt;BR /&gt;4687 var_level char(50),&lt;BR /&gt;4688 var char(50),&lt;BR /&gt;4689 ptpct char(50),&lt;BR /&gt;4690 rord num,&lt;BR /&gt;4691 %do j = 1 %to &amp;amp;gr_cnt;&lt;BR /&gt;ERROR: The %DO statement is not valid in open code.&lt;BR /&gt;4692 %scan(&amp;amp;by_grp, &amp;amp;j) char(50) ,&lt;BR /&gt;WARNING: Apparent symbolic reference J not resolved.&lt;BR /&gt;WARNING: Apparent symbolic reference J not resolved.&lt;BR /&gt;ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric&lt;BR /&gt;operand is required. The condition was: &amp;amp;j&lt;BR /&gt;ERROR: Argument 2 to macro function %SCAN is not a number.&lt;BR /&gt;4692 %scan(&amp;amp;by_grp, &amp;amp;j) char(50) ,&lt;BR /&gt;-&lt;BR /&gt;22&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: CHAR, CHARACTER, DEC, DECIMAL,&lt;BR /&gt;FLOAT, NUM, NUMERIC, VARCHAR.&lt;/P&gt;&lt;P&gt;4692 %scan(&amp;amp;by_grp, &amp;amp;j) char(50) ,&lt;BR /&gt;-&lt;BR /&gt;76&lt;BR /&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/P&gt;&lt;P&gt;4693 %end;&lt;BR /&gt;ERROR: The %END statement is not valid in open code.&lt;BR /&gt;4694 pv char(50)&lt;BR /&gt;4695 ) ;&lt;BR /&gt;4696 quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2016 03:41:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-end-error/m-p/247899#M46509</guid>
      <dc:creator>Ivy</dc:creator>
      <dc:date>2016-02-04T03:41:42Z</dc:date>
    </item>
    <item>
      <title>Re: Do ...end error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-end-error/m-p/247900#M46510</link>
      <description>&lt;P&gt;There are many little problems with that code. Try this instead:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select distinct catx(" ", compress(&amp;amp;by, " -"), "char(50)") into: by_cols separated by "," from &amp;amp;indsn ;
quit;

%put &amp;amp;by_cols ;

proc sql;
create table rpt_cat (
var_level char(50),
var char(50),
ptpct char(50),
rord num,
&amp;amp;by_cols,
pv char(50)
) ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(untested)&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2016 04:06:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-end-error/m-p/247900#M46510</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-02-04T04:06:06Z</dc:date>
    </item>
    <item>
      <title>Re: Do ...end error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-end-error/m-p/247901#M46511</link>
      <description>you are trying to execute the %do %end in open code which is not correct. Please try to put the code in a macro and then execute as below &lt;BR /&gt;&lt;BR /&gt;could you please try and let me know&lt;BR /&gt;&lt;BR /&gt;%macro sample;&lt;BR /&gt;proc sql;&lt;BR /&gt;create table rpt_cat (&lt;BR /&gt;var_level char(50),&lt;BR /&gt;var char(50),&lt;BR /&gt;ptpct char(50),&lt;BR /&gt;rord num,&lt;BR /&gt;%do j = 1 %to &amp;amp;gr_cnt;&lt;BR /&gt;%scan(&amp;amp;by_grp, &amp;amp;j) char(50) ,&lt;BR /&gt;%end;&lt;BR /&gt;pv char(50)&lt;BR /&gt;) ;&lt;BR /&gt;quit;&lt;BR /&gt;%mend sample;&lt;BR /&gt;&lt;BR /&gt;%sample</description>
      <pubDate>Thu, 04 Feb 2016 04:08:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-end-error/m-p/247901#M46511</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2016-02-04T04:08:10Z</dc:date>
    </item>
    <item>
      <title>Re: Do ...end error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-end-error/m-p/247921#M46517</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Two tips. &amp;nbsp;Firstly posting test data in the form of a datastep, and what you want the output to look like, really helps get you code back. &amp;nbsp;Secondly, what is it your trying to do? &amp;nbsp;Demography data is normally create with data down the list, or are you creating SDTM DM domain? &amp;nbsp;Eitehr way this should be part of the programming for the output or dataset. &amp;nbsp;I can't tell without seeing required output however.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2016 09:08:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-end-error/m-p/247921#M46517</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-02-04T09:08:59Z</dc:date>
    </item>
    <item>
      <title>Re: Do ...end error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-end-error/m-p/247976#M46534</link>
      <description>&lt;P&gt;Thank you very much, &amp;nbsp;both solutions from &lt;SPAN class="login-bold"&gt;&lt;U&gt;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462" target="_self"&gt;PGStats&lt;/A&gt;&lt;/U&gt;&amp;nbsp;and &amp;nbsp;&lt;SPAN&gt;&lt;U&gt;&lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;Jagadishkatam &lt;/FONT&gt;&lt;/STRONG&gt;&lt;/U&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;work pretty ! &amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;RW9 , &lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT color="#000000"&gt;I am trying to summary the demographic information.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Thank you again !&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2016 14:24:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-end-error/m-p/247976#M46534</guid>
      <dc:creator>Ivy</dc:creator>
      <dc:date>2016-02-04T14:24:01Z</dc:date>
    </item>
    <item>
      <title>Re: Do ...end error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-end-error/m-p/247978#M46535</link>
      <description>Works pretty ! Thank you so much for pointing out my error.</description>
      <pubDate>Thu, 04 Feb 2016 14:25:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-end-error/m-p/247978#M46535</guid>
      <dc:creator>Ivy</dc:creator>
      <dc:date>2016-02-04T14:25:15Z</dc:date>
    </item>
    <item>
      <title>Re: Do ...end error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-end-error/m-p/248003#M46546</link>
      <description>&lt;P&gt;Hi doesn't really tell me anything I am afraid, test data -&amp;gt; example output. &amp;nbsp;There are numerous ways of getting summarised data which don't need template datasets setup, you could even use generic column names - VARx - for example, save yourself a lot of coding trying to work out what they are called.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2016 15:26:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-end-error/m-p/248003#M46546</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-02-04T15:26:31Z</dc:date>
    </item>
    <item>
      <title>Re: Do ...end error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-end-error/m-p/248045#M46563</link>
      <description>&lt;P&gt;Thank you, RW9 .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I use Varx, should I edit all the summary from proc freq, proc mean, proc univarite to Var... , &amp;nbsp;is that right ?&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2016 17:28:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-end-error/m-p/248045#M46563</guid>
      <dc:creator>Ivy</dc:creator>
      <dc:date>2016-02-04T17:28:57Z</dc:date>
    </item>
  </channel>
</rss>

