<?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: understanding _type_ variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Help-understanding-a-data-step/m-p/395771#M95502</link>
    <description>&lt;P&gt;Filters the data based on the _TYPE_ variable, but since we don't know the source data we can't comment. There are several procs that add a _TYPE_ variable. Do you know which one was used to create the input data set, test.monthly_exch_mv?&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>Wed, 13 Sep 2017 21:18:04 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-09-13T21:18:04Z</dc:date>
    <item>
      <title>Help understanding a data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-understanding-a-data-step/m-p/395760#M95497</link>
      <description>&lt;P&gt;I am a beginner and would you explain what this code does in English?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data monthly;&lt;BR /&gt;set test.monthly_exch_mv(where=(_type_=3));&lt;BR /&gt;by yyyymm exchange;&lt;BR /&gt;format numberofFirms comma8.0;&lt;BR /&gt;drop _type_;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2017 21:18:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-understanding-a-data-step/m-p/395760#M95497</guid>
      <dc:creator>skyline</dc:creator>
      <dc:date>2017-09-13T21:18:49Z</dc:date>
    </item>
    <item>
      <title>Re: understanding _type_ variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-understanding-a-data-step/m-p/395769#M95500</link>
      <description>data monthly: creates a temporary dataset.&lt;BR /&gt;set test.monthly_exch_mv(...): Reads observations having _type_ = 3&lt;BR /&gt;The BY-statement has no effect.&lt;BR /&gt;Format: applies the format comma8.0 to numberOfFirms.&lt;BR /&gt;Drop: the variable _type_ is not stored in thr result-dataset.</description>
      <pubDate>Wed, 13 Sep 2017 21:16:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-understanding-a-data-step/m-p/395769#M95500</guid>
      <dc:creator>error_prone</dc:creator>
      <dc:date>2017-09-13T21:16:21Z</dc:date>
    </item>
    <item>
      <title>Re: understanding _type_ variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-understanding-a-data-step/m-p/395770#M95501</link>
      <description>&lt;P&gt;Within a DATA step, _TYPE_ is nothing special.&amp;nbsp; It's just the name of a variable that exists within the incoming data set TEST.MONTHLY_EXCH_MV.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The WHERE clause subsets which observations should be read in from that incoming data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The harder part is what you don't see here.&amp;nbsp; How did _TYPE_ get created within the data, what values does it take on, and why read in those observations where _TYPE_ is 3?&amp;nbsp; For that, you will need to do a little bit of studying (perhaps more than a little), but I can point you in the right direction.&amp;nbsp; Almost certainly, there is an earlier PROC MEANS or PROC SUMMARY that creates _TYPE_.&amp;nbsp; Look at the documentation for either of those procedures (they perform the same calculations, so it doesn't matter which one you choose).&amp;nbsp; In particular, look at the effects of adding a CLASS statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Experiment with a few PROC SUMMARY examples, to get a feel for the values of _TYPE_.&amp;nbsp; It may not be the easiest thing in the world, but it is worthwhile to spend the time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2017 21:16:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-understanding-a-data-step/m-p/395770#M95501</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-09-13T21:16:31Z</dc:date>
    </item>
    <item>
      <title>Re: understanding _type_ variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-understanding-a-data-step/m-p/395771#M95502</link>
      <description>&lt;P&gt;Filters the data based on the _TYPE_ variable, but since we don't know the source data we can't comment. There are several procs that add a _TYPE_ variable. Do you know which one was used to create the input data set, test.monthly_exch_mv?&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>Wed, 13 Sep 2017 21:18:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-understanding-a-data-step/m-p/395771#M95502</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-09-13T21:18:04Z</dc:date>
    </item>
    <item>
      <title>Re: Help understanding a data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-understanding-a-data-step/m-p/395772#M95503</link>
      <description>FYI - I updated the title to help clarify your question</description>
      <pubDate>Wed, 13 Sep 2017 21:19:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-understanding-a-data-step/m-p/395772#M95503</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-09-13T21:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: understanding _type_ variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-understanding-a-data-step/m-p/395779#M95507</link>
      <description>&lt;P&gt;Yes, a special variable named _type_ is created by several SAS procedures. ALSO, a variable named _type_ can be created in a data step:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; test;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; sales_id $&lt;/FONT&gt;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sales_jn&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sales_fe&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sales_mr;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;datalines&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;W6790 50 400 350&lt;/P&gt;&lt;P&gt;W7693 25 100 125&lt;/P&gt;&lt;P&gt;W1387 99 300 250&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; tot;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; test;&lt;/FONT&gt;&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; _type_ = sales_jn + sales_fe + sales_mr;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; sel;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; tot(&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;where&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=(_type_=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;250&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;));&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;OUTPUT: test&lt;/FONT&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;sales_id&lt;/TD&gt;&lt;TD&gt;sales_jn&lt;/TD&gt;&lt;TD&gt;sales_fe&lt;/TD&gt;&lt;TD&gt;sales_mr&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;W6790&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;TD&gt;400&lt;/TD&gt;&lt;TD&gt;350&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;W7693&lt;/TD&gt;&lt;TD&gt;25&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;125&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;W1387&lt;/TD&gt;&lt;TD&gt;99&lt;/TD&gt;&lt;TD&gt;300&lt;/TD&gt;&lt;TD&gt;250&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;OUTPUT: &amp;nbsp;tot&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;sales_id&lt;/TD&gt;&lt;TD&gt;sales_jn&lt;/TD&gt;&lt;TD&gt;sales_fe&lt;/TD&gt;&lt;TD&gt;sales_mr&lt;/TD&gt;&lt;TD&gt;_type_&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;W6790&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;TD&gt;400&lt;/TD&gt;&lt;TD&gt;350&lt;/TD&gt;&lt;TD&gt;800&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;W7693&lt;/TD&gt;&lt;TD&gt;25&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;125&lt;/TD&gt;&lt;TD&gt;250&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;W1387&lt;/TD&gt;&lt;TD&gt;99&lt;/TD&gt;&lt;TD&gt;300&lt;/TD&gt;&lt;TD&gt;250&lt;/TD&gt;&lt;TD&gt;649&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;OUTPUT: sel&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;sales_id&lt;/TD&gt;&lt;TD&gt;sales_jn&lt;/TD&gt;&lt;TD&gt;sales_fe&lt;/TD&gt;&lt;TD&gt;sales_mr&lt;/TD&gt;&lt;TD&gt;_type_&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;W7693&lt;/TD&gt;&lt;TD&gt;25&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;125&lt;/TD&gt;&lt;TD&gt;250&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Wed, 13 Sep 2017 21:55:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-understanding-a-data-step/m-p/395779#M95507</guid>
      <dc:creator>silasj</dc:creator>
      <dc:date>2017-09-13T21:55:30Z</dc:date>
    </item>
    <item>
      <title>Re: Help understanding a data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-understanding-a-data-step/m-p/395834#M95534</link>
      <description>&lt;P&gt;&lt;SPAN&gt;data monthly; /* You are creating an output data set named MONTHLY; This is a temporary data set and will be stored in the WORK library; It gets deleted once you terminate your sas session */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;set test.monthly_exch_mv(where=(_type_=3)); /* &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;#1 test.monthly_exch_mv is your source data set. &amp;nbsp;You applied a filter where you want the records to be _type_=3 only &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;#TEST - is a permanent library which is assigned in the libname statement&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;A libname statement is an alias to a path or a folder location;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Once you terminate your sas session the dataset&amp;nbsp;monthly_exch_mv&amp;nbsp;will still be there "physically" (as stated in the location defined in your libname TEST statement)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;by yyyymm exchange; /* I presume here the variables yyyymm and exchange were pre-sorted, serves as a grouping or classification variables but does not seem to have any effect in your succeeding statements below */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN&gt;format numberofFirms comma8.0; /* format statement is used because you want the value to appear in max length of 8 with commas)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN&gt;drop _type_; &amp;nbsp;(you do not want to see this variable in your output dataset */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;run; /* execute and termiantes the data step&amp;nbsp;*/&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2017 02:00:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-understanding-a-data-step/m-p/395834#M95534</guid>
      <dc:creator>ShiroAmada</dc:creator>
      <dc:date>2017-09-14T02:00:27Z</dc:date>
    </item>
  </channel>
</rss>

