<?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 collect data within date range in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/collect-data-within-date-range/m-p/594304#M170718</link>
    <description>&lt;P&gt;&lt;STRONG&gt;Hi, I am using the following to download crsp/Compustat data. I want to download daily stock data not monthly. So, I have to change msf to&amp;nbsp; dsf. Am I right? And I need data from 2000 to 2015.&amp;nbsp; I don't need all the historical data. How will I customize the date? I also need the outstanding share to collect. Please help.&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table CCM_LINK as&lt;BR /&gt;select distinct a.permno, gvkey, liid as iid,&lt;BR /&gt;date, prc, vol, ret&lt;BR /&gt;from&lt;BR /&gt;crsp.&lt;STRONG&gt;msf&lt;/STRONG&gt; as a, /*CRSP Monthly stock file*/&lt;BR /&gt;crsp.msenames&lt;BR /&gt;(&lt;BR /&gt;where=(shrcd in (10 11)) /*Common stocks of U.S. Companies*/&lt;BR /&gt;) as b,&lt;BR /&gt;ccm.Ccmxpf_linktable&lt;BR /&gt;(&lt;BR /&gt;where=(&lt;BR /&gt;linktype in ('LU' 'LC') /*KEEP reliable LINKS only*/&lt;BR /&gt;and LINKPRIM in ('P' 'C') /*KEEP primary Links*/&lt;BR /&gt;and USEDFLAG=1 ) /*Legacy condition, no longer necessary*/&lt;BR /&gt;) as c&lt;BR /&gt;where a.permno=b.permno=c.lpermno /*Linking by permno*/&lt;BR /&gt;&lt;STRONG&gt;and NAMEDT&amp;lt;=a.date&amp;lt;=NAMEENDT /*CRSP Date range conditions*/&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;and linkdt&amp;lt;=a.date&amp;lt;=coalesce(linkenddt, today()); /*LinkTable Date range conditions*/&lt;/STRONG&gt;&lt;BR /&gt;quit;&lt;BR /&gt;proc download data=CCM_LINK out=common.ccm_link; run;&lt;BR /&gt;endrsubmit;&lt;/P&gt;</description>
    <pubDate>Sun, 06 Oct 2019 04:57:49 GMT</pubDate>
    <dc:creator>abdulla</dc:creator>
    <dc:date>2019-10-06T04:57:49Z</dc:date>
    <item>
      <title>collect data within date range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/collect-data-within-date-range/m-p/594304#M170718</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Hi, I am using the following to download crsp/Compustat data. I want to download daily stock data not monthly. So, I have to change msf to&amp;nbsp; dsf. Am I right? And I need data from 2000 to 2015.&amp;nbsp; I don't need all the historical data. How will I customize the date? I also need the outstanding share to collect. Please help.&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table CCM_LINK as&lt;BR /&gt;select distinct a.permno, gvkey, liid as iid,&lt;BR /&gt;date, prc, vol, ret&lt;BR /&gt;from&lt;BR /&gt;crsp.&lt;STRONG&gt;msf&lt;/STRONG&gt; as a, /*CRSP Monthly stock file*/&lt;BR /&gt;crsp.msenames&lt;BR /&gt;(&lt;BR /&gt;where=(shrcd in (10 11)) /*Common stocks of U.S. Companies*/&lt;BR /&gt;) as b,&lt;BR /&gt;ccm.Ccmxpf_linktable&lt;BR /&gt;(&lt;BR /&gt;where=(&lt;BR /&gt;linktype in ('LU' 'LC') /*KEEP reliable LINKS only*/&lt;BR /&gt;and LINKPRIM in ('P' 'C') /*KEEP primary Links*/&lt;BR /&gt;and USEDFLAG=1 ) /*Legacy condition, no longer necessary*/&lt;BR /&gt;) as c&lt;BR /&gt;where a.permno=b.permno=c.lpermno /*Linking by permno*/&lt;BR /&gt;&lt;STRONG&gt;and NAMEDT&amp;lt;=a.date&amp;lt;=NAMEENDT /*CRSP Date range conditions*/&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;and linkdt&amp;lt;=a.date&amp;lt;=coalesce(linkenddt, today()); /*LinkTable Date range conditions*/&lt;/STRONG&gt;&lt;BR /&gt;quit;&lt;BR /&gt;proc download data=CCM_LINK out=common.ccm_link; run;&lt;BR /&gt;endrsubmit;&lt;/P&gt;</description>
      <pubDate>Sun, 06 Oct 2019 04:57:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/collect-data-within-date-range/m-p/594304#M170718</guid>
      <dc:creator>abdulla</dc:creator>
      <dc:date>2019-10-06T04:57:49Z</dc:date>
    </item>
    <item>
      <title>Re: collect data within date range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/collect-data-within-date-range/m-p/595286#M171224</link>
      <description>&lt;P&gt;You'll have to provide more info about your data. What is the format of your date variables? Do a.date, namedt, nameendt linkdt and linkenddt have the same formats?&lt;/P&gt;&lt;P&gt;Also can you please type your code using the Insert SAS code button so it is easier to read, and add an alias for all the variables.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 08:19:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/collect-data-within-date-range/m-p/595286#M171224</guid>
      <dc:creator>sustagens</dc:creator>
      <dc:date>2019-10-10T08:19:28Z</dc:date>
    </item>
  </channel>
</rss>

