<?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: Help with Running a Do Loop with list of variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Help-with-Running-a-Do-Loop-with-list-of-variables/m-p/371501#M88753</link>
    <description>&lt;P&gt;This looks much more like a report than a data set. &amp;nbsp;Have you tried something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc tabulate data=pat_list_final;&lt;/P&gt;
&lt;P&gt;class&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;VLBW_YN CMV_IND sex locate ethnicity race;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;tables sex locate ethnicity race, vlbw_yn * cmv_ind;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;There are many ways to improve the appearance of the report. &amp;nbsp;At this point, let's at least look at the possibility that it can be done in a single step, letting SAS do all the work.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 29 Jun 2017 00:40:59 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2017-06-29T00:40:59Z</dc:date>
    <item>
      <title>Help with Running a Do Loop with list of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-Running-a-Do-Loop-with-list-of-variables/m-p/371483#M88740</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a patient list w/ 20+ different variables - sex, location, ethnicity, race, etc. I want to create a loop that will create tables for each one.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA VARIABLES;&lt;BR /&gt;INFILE DATALINES DSD;&lt;BR /&gt;ROW = _N_;&lt;BR /&gt;INPUT VAR :$ 9.;&lt;BR /&gt;DATALINES;&lt;BR /&gt;SEX&lt;BR /&gt;LOCATE&lt;/P&gt;&lt;P&gt;ETHNICITY&lt;/P&gt;&lt;P&gt;RACE&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC SQL NOPRINT;&lt;BR /&gt;SELECT VAR INTO:PARAMLIST&lt;BR /&gt;SEPARATED BY ' '&lt;BR /&gt;FROM VARIABLES;&lt;BR /&gt;QUIT;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE &amp;amp;PARAMLIST AS&lt;BR /&gt;SELECT&amp;nbsp;&lt;/P&gt;&lt;P&gt;VARIABLE AS VAR&lt;BR /&gt;,A.VLBW_YN&lt;BR /&gt;,A.CMV_IND&lt;BR /&gt;,COUNT(*) AS COUNT&lt;BR /&gt;FROM PAT_LIST_FINAL A&lt;BR /&gt;WHERE A.VIRAL_YN = 1&lt;BR /&gt;GROUP BY 1,2,3&lt;BR /&gt;;&lt;BR /&gt;QUIT;&lt;/P&gt;&lt;P&gt;PROC TRANSPOSE DATA=VARIABLE OUT=VARIABLE2 (DROP=_NAME_);&lt;BR /&gt;BY VAR;&lt;BR /&gt;ID VLBW_YN CMV_IND;&lt;BR /&gt;VAR COUNT;&lt;BR /&gt;RUN;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jun 2017 22:37:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-Running-a-Do-Loop-with-list-of-variables/m-p/371483#M88740</guid>
      <dc:creator>Woop122</dc:creator>
      <dc:date>2017-06-28T22:37:35Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Running a Do Loop with list of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-Running-a-Do-Loop-with-list-of-variables/m-p/371486#M88742</link>
      <description>&lt;P&gt;You have several issues here, beginning with the CREATE statement that lists several table names where there should only be one. &amp;nbsp;You would be much better off showing what your data looks like now, specifying whether you are looking for a data set vs. a report as the output, and illustrating what the output should look like. &amp;nbsp;It may be possible to create what you need without looping, which would certainly cut in half the time it takes to produce the result you want.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jun 2017 23:03:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-Running-a-Do-Loop-with-list-of-variables/m-p/371486#M88742</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-06-28T23:03:30Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Running a Do Loop with list of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-Running-a-Do-Loop-with-list-of-variables/m-p/371488#M88743</link>
      <description>&lt;P&gt;You say "create tables for each one". Each variable? Each Patient? Each combination of some thing?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;May I ask what you will do with those? Almost every process I have seen where people start tearing there datasets apart ends up with a a very convoluted and difficult procedure to put things back together for other purposes later.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It really does help to show some starting data, fake values are okay as long as they demonstrate the behavior of your actual data, and what the final result looks like.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the idea is to get counts of patients by demographics you are doing a lot of extra work.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jun 2017 23:11:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-Running-a-Do-Loop-with-list-of-variables/m-p/371488#M88743</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-06-28T23:11:43Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Running a Do Loop with list of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-Running-a-Do-Loop-with-list-of-variables/m-p/371489#M88744</link>
      <description>&lt;P&gt;I am trying to create a table of counts based on each variable.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;You say "create tables for each one". Each variable? Each Patient? Each combination of some thing?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;May I ask what you will do with those? Almost every process I have seen where people start tearing there datasets apart ends up with a a very convoluted and difficult procedure to put things back together for other purposes later.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It really does help to show some starting data, fake values are okay as long as they demonstrate the behavior of your actual data, and what the final result looks like.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the idea is to get counts of patients by demographics you are doing a lot of extra work.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;I already have it done, but wanted to do it more efficiently.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; VLBW - Infection VLBW - No Infection. &amp;nbsp;Non-VLBW - Infection Non-VLBW - No Infection&lt;/P&gt;&lt;P&gt;Female&lt;/P&gt;&lt;P&gt;Male&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Locate of Birth 1&lt;/P&gt;&lt;P&gt;Locate of Birth 2&lt;/P&gt;&lt;P&gt;Locate of Birth 3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hispanic&lt;/P&gt;&lt;P&gt;Non-Hispanic&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;etc&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jun 2017 23:20:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-Running-a-Do-Loop-with-list-of-variables/m-p/371489#M88744</guid>
      <dc:creator>Woop122</dc:creator>
      <dc:date>2017-06-28T23:20:47Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Running a Do Loop with list of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-Running-a-Do-Loop-with-list-of-variables/m-p/371501#M88753</link>
      <description>&lt;P&gt;This looks much more like a report than a data set. &amp;nbsp;Have you tried something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc tabulate data=pat_list_final;&lt;/P&gt;
&lt;P&gt;class&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;VLBW_YN CMV_IND sex locate ethnicity race;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;tables sex locate ethnicity race, vlbw_yn * cmv_ind;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;There are many ways to improve the appearance of the report. &amp;nbsp;At this point, let's at least look at the possibility that it can be done in a single step, letting SAS do all the work.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2017 00:40:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-Running-a-Do-Loop-with-list-of-variables/m-p/371501#M88753</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-06-29T00:40:59Z</dc:date>
    </item>
  </channel>
</rss>

