<?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: Trying to extract from .sas7bdat file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-extract-from-sas7bdat-file/m-p/810194#M319495</link>
    <description>&lt;P&gt;I am a little confused.&lt;/P&gt;
&lt;P&gt;Here&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname fac "&amp;amp;cipath./Ref/MasterFac/output";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;you use forward slashes, which is typical (and mandatory) for UNIX path names.&lt;/P&gt;
&lt;P&gt;But here&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;set 'R:\Ref\MasterFac\output\fac_npi_network_may_2022.sas7bdat';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;you use an obvious Windows path.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your SAS session does in fact run on a UNIX server, then you won't be able to access a location on your desktop computer like this, even if it is a shared network resource.&lt;/P&gt;</description>
    <pubDate>Wed, 27 Apr 2022 15:23:55 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2022-04-27T15:23:55Z</dc:date>
    <item>
      <title>Trying to extract from .sas7bdat file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-extract-from-sas7bdat-file/m-p/810184#M319488</link>
      <description>&lt;P&gt;How do I extract data from a .sas7bdat file?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname fac "&amp;amp;cipath./Ref/MasterFac/output";

proc sql;
create table irf
as select *
from foundry.inpatientEvents
where serviceFacility = 'PL'
and dischargeDisposition = 'Rehab'
and planPayer='xxx'
and admitdate between "2021-01-01" and "2021-12-31"
and claimrisk=1; 
quit;

DATA fac; 
  set 'R:\Ref\MasterFac\output\fac_npi_network_may_2022.sas7bdat'; 
RUN; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Apr 2022 15:02:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-extract-from-sas7bdat-file/m-p/810184#M319488</guid>
      <dc:creator>anonymous_user</dc:creator>
      <dc:date>2022-04-27T15:02:00Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to extract from .sas7bdat file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-extract-from-sas7bdat-file/m-p/810187#M319490</link>
      <description>&lt;P&gt;Would look something like this, assuming the data set is in the folder you reference in the libname statement (as&amp;nbsp;fac_npi_network_may_2022.sas7bdat) and&amp;nbsp;&lt;STRONG&gt;admitdate&lt;/STRONG&gt; is a true date value. Result would land in WORK.IRF.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;libname fac "&amp;amp;cipath./Ref/MasterFac/output";

proc sql;
  create table irf
    as select *
        from fac.fac_npi_network_may_2022
        where serviceFacility = 'PL'
          and dischargeDisposition = 'Rehab'
          and planPayer='xxx'
          and year(admitdate) = 2021
          and claimrisk=1
     ;
quit;
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your code you reference foundry.inpatientEvents -- is that the true source and the FOUNDRY libname is already defined? If so then you were close:&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;libname fac "&amp;amp;cipath./Ref/MasterFac/output";

proc sql;
  create table irf
    as select *
        from foundry.inpatientEvents
        where serviceFacility = 'PL'
          and dischargeDisposition = 'Rehab'
          and planPayer='xxx'
          and year(admitdate) = 2021
          and claimrisk=1
     ;
quit;
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;EM&gt;&amp;nbsp;(Edited a few times here because I kept rereading and realizing I don't have all of the info for definitive answer...)&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Apr 2022 15:15:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-extract-from-sas7bdat-file/m-p/810187#M319490</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2022-04-27T15:15:56Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to extract from .sas7bdat file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-extract-from-sas7bdat-file/m-p/810189#M319491</link>
      <description>I've done it that way, and it says the file does not exist.  I'm getting this error after the statement  libname fac "&amp;amp;cipath./Ref/MasterFac/output";   :&lt;BR /&gt;WARNING: Apparent symbolic reference CIPATH not resolved.&lt;BR /&gt;NOTE: Library FAC does not exist.</description>
      <pubDate>Wed, 27 Apr 2022 15:15:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-extract-from-sas7bdat-file/m-p/810189#M319491</guid>
      <dc:creator>anonymous_user</dc:creator>
      <dc:date>2022-04-27T15:15:45Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to extract from .sas7bdat file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-extract-from-sas7bdat-file/m-p/810190#M319492</link>
      <description>&lt;P&gt;CIPATH must be a macro variable that you copied from someone else's code? You could place this at the top, copying the path you reference later.&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;%let CIPATH = R:\Ref\MasterFac\output;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Apr 2022 15:18:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-extract-from-sas7bdat-file/m-p/810190#M319492</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2022-04-27T15:18:47Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to extract from .sas7bdat file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-extract-from-sas7bdat-file/m-p/810194#M319495</link>
      <description>&lt;P&gt;I am a little confused.&lt;/P&gt;
&lt;P&gt;Here&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname fac "&amp;amp;cipath./Ref/MasterFac/output";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;you use forward slashes, which is typical (and mandatory) for UNIX path names.&lt;/P&gt;
&lt;P&gt;But here&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;set 'R:\Ref\MasterFac\output\fac_npi_network_may_2022.sas7bdat';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;you use an obvious Windows path.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your SAS session does in fact run on a UNIX server, then you won't be able to access a location on your desktop computer like this, even if it is a shared network resource.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Apr 2022 15:23:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-extract-from-sas7bdat-file/m-p/810194#M319495</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-04-27T15:23:55Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to extract from .sas7bdat file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-extract-from-sas7bdat-file/m-p/810196#M319496</link>
      <description>&lt;P&gt;I'm still getting an error; it looks like I'm missing punctuation or something:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;49 proc sql;
50 create table irf2
51 as select *
52 from &amp;amp;cipath.fac_npi_network_may_2022.sas7bdat;
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
NOTE: Line generated by the macro variable "CIPATH".
52 R:\Ref\Master Fac\output\fac_npi_network_may_2022.sas7bdat
_
22
76
ERROR 22-322: Syntax error, expecting one of the following: a name, ;, (, ',', '.', ANSIMISS, AS, CROSS, EXCEPT, FULL, GROUP,
HAVING, INNER, INTERSECT, JOIN, LEFT, NATURAL, NOMISS, ORDER, OUTER, RIGHT, UNION, WHERE.

ERROR 76-322: Syntax error, statement will be ignored.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Apr 2022 15:31:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-extract-from-sas7bdat-file/m-p/810196#M319496</guid>
      <dc:creator>anonymous_user</dc:creator>
      <dc:date>2022-04-27T15:31:02Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to extract from .sas7bdat file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-extract-from-sas7bdat-file/m-p/810199#M319498</link>
      <description>&lt;P&gt;Just like in the SET statement of the DATA step, the physical filename in PROC SQL must be enclosed in quotes.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Apr 2022 15:36:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-extract-from-sas7bdat-file/m-p/810199#M319498</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-04-27T15:36:11Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to extract from .sas7bdat file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-extract-from-sas7bdat-file/m-p/810200#M319499</link>
      <description>&lt;P&gt;Where is your source data exactly? Path and file? And to&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;'s point, is your SAS really on Windows or is it UNIX?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it's in&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;R:\Ref\MasterFac\output\fac_npi_network_may_2022.sas7bdat&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then this would work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;libname fac "R:\Ref\MasterFac\output";
proc sql;
  create table irf
    as select *
        from fac.fac_npi_network_may_2022
        where serviceFacility = 'PL'
          and dischargeDisposition = 'Rehab'
          and planPayer='xxx'
          and year(admitdate) = 2021
          and claimrisk=1
     ;
quit;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;To clear up a common question about forward/back slashes &lt;/SPAN&gt;&lt;STRONG style="font-family: inherit;"&gt;in SAS&lt;/STRONG&gt;&lt;SPAN&gt;: forward slash always works (UNIX or Windows), but backslash works only on Windows.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hence if you're running on Windows, this is valid:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;%let CIPATH = R: ;
libname fac "&amp;amp;cipath./Ref/MasterFac/output";&lt;/LI-CODE&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, 27 Apr 2022 15:38:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-extract-from-sas7bdat-file/m-p/810200#M319499</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2022-04-27T15:38:11Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to extract from .sas7bdat file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-extract-from-sas7bdat-file/m-p/810257#M319516</link>
      <description>I added the quotes, Now it's saying it's too long:&lt;BR /&gt;&lt;BR /&gt;ERROR: The physical file name "R:\Ref\Master Fac\output\fac_npi_network_may_2022.sas7bdat" is too long.&lt;BR /&gt;I've tried removing the sas7bdat extension; i've tried using a macro to call the month and year - still get the same error message.</description>
      <pubDate>Wed, 27 Apr 2022 18:53:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-extract-from-sas7bdat-file/m-p/810257#M319516</guid>
      <dc:creator>anonymous_user</dc:creator>
      <dc:date>2022-04-27T18:53:54Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to extract from .sas7bdat file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-extract-from-sas7bdat-file/m-p/810262#M319520</link>
      <description>&lt;P&gt;Then you best define a LIBNAME for&lt;/P&gt;
&lt;PRE&gt;R:\Ref\Master Fac\output&lt;/PRE&gt;
&lt;P&gt;and address the dataset through that library.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Apr 2022 19:02:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-extract-from-sas7bdat-file/m-p/810262#M319520</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-04-27T19:02:30Z</dc:date>
    </item>
  </channel>
</rss>

