<?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: How do I create a data set with multiple variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-a-data-set-with-multiple-variables/m-p/946862#M370770</link>
    <description>&lt;P&gt;Are you asking how to create data sets?&lt;/P&gt;
&lt;P&gt;Or to have the output displayed differently?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to create a single data set with the output of multiple Tables statements in PROC FREQ you have two choices:&lt;/P&gt;
&lt;P&gt;Old school: Use an out= option on each table statement to create an output data set for each (only one data set per table statement). Then combine them. Whether a Merge or Append would be the better option would depend on what you expected.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If ALL of the tables are crosstabs you can use ODS OUTPUT.&lt;/P&gt;
&lt;P&gt;An example you should be able to run and examine the output data set mycrosstabdataset.&lt;/P&gt;
&lt;PRE&gt;proc freq data=sashelp.cars;
  ods output crosstabfreqs=mycrosstabdataset;
  tables make*origin;
  tables make*cylinders;
  tables make*type;
run;&lt;/PRE&gt;
&lt;P&gt;The data set has a lot of information because of different variables and table requests used.&lt;/P&gt;
&lt;P&gt;Note the above could be created with a table statement like&lt;/P&gt;
&lt;PRE&gt;table make *(origin cylinders type);&lt;/PRE&gt;
&lt;P&gt;If it is to display differently then perhaps a different procedure. &lt;/P&gt;
&lt;PRE&gt;proc tabulate data=sashelp.cars;
   class make origin cylinders type;
   table make,
         (origin cylinders type)*n='Count';
run;&lt;/PRE&gt;</description>
    <pubDate>Wed, 09 Oct 2024 20:38:29 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2024-10-09T20:38:29Z</dc:date>
    <item>
      <title>How do I create a data set with multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-a-data-set-with-multiple-variables/m-p/946850#M370765</link>
      <description>&lt;P&gt;Hello.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to SAS. I am learning to write efficient code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I take my dataset and have it output based on at least three different variables (sex, county and age categories) over a period of time. Not sure if I need to add a merge step&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;ods excel file="NoName2024.xlsx";&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;proc freq data=births;&lt;/DIV&gt;&lt;DIV&gt;title 'Dataset, 2018-2023';&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; table YOB*age_cat /norow nocol nopercent;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;table&amp;nbsp; sex*age_cat/norow nocol nopercent;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;table&amp;nbsp; county*age_cat/norow nocol nopercent;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; run;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2024 20:07:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-a-data-set-with-multiple-variables/m-p/946850#M370765</guid>
      <dc:creator>HauteDoc</dc:creator>
      <dc:date>2024-10-09T20:07:47Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create a data set with multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-a-data-set-with-multiple-variables/m-p/946862#M370770</link>
      <description>&lt;P&gt;Are you asking how to create data sets?&lt;/P&gt;
&lt;P&gt;Or to have the output displayed differently?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to create a single data set with the output of multiple Tables statements in PROC FREQ you have two choices:&lt;/P&gt;
&lt;P&gt;Old school: Use an out= option on each table statement to create an output data set for each (only one data set per table statement). Then combine them. Whether a Merge or Append would be the better option would depend on what you expected.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If ALL of the tables are crosstabs you can use ODS OUTPUT.&lt;/P&gt;
&lt;P&gt;An example you should be able to run and examine the output data set mycrosstabdataset.&lt;/P&gt;
&lt;PRE&gt;proc freq data=sashelp.cars;
  ods output crosstabfreqs=mycrosstabdataset;
  tables make*origin;
  tables make*cylinders;
  tables make*type;
run;&lt;/PRE&gt;
&lt;P&gt;The data set has a lot of information because of different variables and table requests used.&lt;/P&gt;
&lt;P&gt;Note the above could be created with a table statement like&lt;/P&gt;
&lt;PRE&gt;table make *(origin cylinders type);&lt;/PRE&gt;
&lt;P&gt;If it is to display differently then perhaps a different procedure. &lt;/P&gt;
&lt;PRE&gt;proc tabulate data=sashelp.cars;
   class make origin cylinders type;
   table make,
         (origin cylinders type)*n='Count';
run;&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Oct 2024 20:38:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-a-data-set-with-multiple-variables/m-p/946862#M370770</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-10-09T20:38:29Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create a data set with multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-a-data-set-with-multiple-variables/m-p/946871#M370778</link>
      <description>&lt;P&gt;In what way to you want the output to be different than the default PROC FREQ output?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note:&amp;nbsp; You title talks about creating a DATASET, but your posted code is instead using an existing dataset to make a REPORT.&amp;nbsp; Which of the two different topics to you need help with?&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2024 22:37:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-a-data-set-with-multiple-variables/m-p/946871#M370778</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-10-09T22:37:08Z</dc:date>
    </item>
  </channel>
</rss>

