<?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: GPG Files Readin in SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Read-in-GPG-Encrypted-Files-in-SAS/m-p/462939#M117883</link>
    <description>&lt;P&gt;So you have a file that was probably created with something like&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;gzip -c file.txt|gpg&amp;gt;file.txt.gpg&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(I've omitted the gpg options for accepting stdin and writing to stdout)&lt;/P&gt;
&lt;P&gt;So it is text compressed with gzip encrypted with gpg.&lt;/P&gt;
&lt;P&gt;To read that, you need to unravel everything in the reverse order of its creation:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename reader pipe "gpg --decrypt &amp;amp;PATH.\Rawdata\Test3.txt.gpg|gzip -dc";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So the decrypted stream is fed to gzip, which is told by the parameters to decompress and write to standard output; since no filename is given, gzip will read from stdin and therefore the pipe from gpg.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;An alternative would be to decrypt to a file first, and then read that with filename zip with the gzip option.&lt;/P&gt;</description>
    <pubDate>Thu, 17 May 2018 07:02:01 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-05-17T07:02:01Z</dc:date>
    <item>
      <title>Read in GPG Encrypted Files in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-in-GPG-Encrypted-Files-in-SAS/m-p/462311#M117686</link>
      <description>&lt;P&gt;I have a file test.txt.gpg, a text file encrypted with a pass phrase. How should I readin in SAS? I have gone through other posts and found that there is a way to decrypt first using X command and then readin. Need more inputs&lt;/P&gt;</description>
      <pubDate>Tue, 15 May 2018 15:22:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-in-GPG-Encrypted-Files-in-SAS/m-p/462311#M117686</guid>
      <dc:creator>Konakanchi</dc:creator>
      <dc:date>2018-05-15T15:22:48Z</dc:date>
    </item>
    <item>
      <title>Re: GPG Files Readin in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-in-GPG-Encrypted-Files-in-SAS/m-p/462314#M117688</link>
      <description>X command simply runs the syntax you provide it on the system shell.&lt;BR /&gt;When it comes to what you need to put into the X statement please refer to the gnupg documentation.&lt;BR /&gt;&lt;A href="https://www.gnupg.org/documentation/manuals.html" target="_blank"&gt;https://www.gnupg.org/documentation/manuals.html&lt;/A&gt;&lt;BR /&gt;If you can decrypt it in a command prompt, then what you run in there is what you are going to put inside your X statement inside SAS.&lt;BR /&gt;&lt;BR /&gt;Once you have the document decrypted you'd read it like any other raw data file into SAS.</description>
      <pubDate>Tue, 15 May 2018 12:06:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-in-GPG-Encrypted-Files-in-SAS/m-p/462314#M117688</guid>
      <dc:creator>SimonDawson</dc:creator>
      <dc:date>2018-05-15T12:06:01Z</dc:date>
    </item>
    <item>
      <title>Re: GPG Files Readin in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-in-GPG-Encrypted-Files-in-SAS/m-p/462317#M117691</link>
      <description>&lt;P&gt;My syntax looks like&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%MACRO DATA_READIN(LIB,FILE,DSN);&lt;/P&gt;&lt;P&gt;* Supplying the data to SAS through PIPE, as the files are compressed ;&lt;/P&gt;&lt;P&gt;FILENAME READER PIPE "M:\Rawdata\&amp;amp;FILE..txt.gpg";&lt;/P&gt;&lt;P&gt;DATA &amp;amp;LIB..&amp;amp;DSN. (COMPRESS=YES) ;&lt;BR /&gt;%LET _EFIERR_ = 0; /* set the ERROR detection macro variable */&lt;BR /&gt;INFILE READER DELIMITER = '|' TRUNCOVER DSD LRECL=32767 FIRSTOBS=1;&lt;BR /&gt;INPUT&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am able to decrypt the file through this but the program is end. The next lines of program aren't running.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Log says&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: The infile READER is:&lt;BR /&gt;Unnamed Pipe Access Device,&lt;BR /&gt;PROCESS=M:\Rawdata\Test1.txt.gpg,&lt;BR /&gt;RECFM=V,LRECL=32767&lt;/P&gt;&lt;P&gt;NOTE: 0 records were read from the infile READER.&lt;BR /&gt;NOTE: The data set RSASDATA.T1 has 0 observations and 69 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 6.36 seconds&lt;BR /&gt;cpu time 0.04 seconds&lt;/P&gt;</description>
      <pubDate>Tue, 15 May 2018 12:15:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-in-GPG-Encrypted-Files-in-SAS/m-p/462317#M117691</guid>
      <dc:creator>Konakanchi</dc:creator>
      <dc:date>2018-05-15T12:15:28Z</dc:date>
    </item>
    <item>
      <title>Re: GPG Files Readin in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-in-GPG-Encrypted-Files-in-SAS/m-p/462320#M117694</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/201377"&gt;@Konakanchi&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;My syntax looks like&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%MACRO DATA_READIN(LIB,FILE,DSN);&lt;/P&gt;
&lt;P&gt;* Supplying the data to SAS through PIPE, as the files are compressed ;&lt;/P&gt;
&lt;P&gt;FILENAME READER PIPE "M:\Rawdata\&amp;amp;FILE..txt.gpg";&lt;/P&gt;
&lt;P&gt;DATA &amp;amp;LIB..&amp;amp;DSN. (COMPRESS=YES) ;&lt;BR /&gt;%LET _EFIERR_ = 0; /* set the ERROR detection macro variable */&lt;BR /&gt;INFILE READER DELIMITER = '|' TRUNCOVER DSD LRECL=32767 FIRSTOBS=1;&lt;BR /&gt;INPUT&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am able to decrypt the file through this but the program is end. The next lines of program aren't running.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Log says&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NOTE: The infile READER is:&lt;BR /&gt;Unnamed Pipe Access Device,&lt;BR /&gt;PROCESS=M:\Rawdata\Test1.txt.gpg,&lt;BR /&gt;RECFM=V,LRECL=32767&lt;/P&gt;
&lt;P&gt;NOTE: 0 records were read from the infile READER.&lt;BR /&gt;NOTE: The data set RSASDATA.T1 has 0 observations and 69 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 6.36 seconds&lt;BR /&gt;cpu time 0.04 seconds&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That happens because M:\Rawdata\&amp;amp;FILE..txt.gpg is just a file and not something that can be &lt;EM&gt;run&lt;/EM&gt; on the system.&lt;/P&gt;
&lt;P&gt;In filename pipe, you need to supply a commandline that decrypts the file and writes the decrypted contents to standard output (which is what you then read in SAS).&lt;/P&gt;
&lt;P&gt;So you need to first find out (see the gnupg documentation referenced earlier by &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11650"&gt;@SimonDawson&lt;/a&gt;) how to do that.&lt;/P&gt;</description>
      <pubDate>Tue, 15 May 2018 12:23:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-in-GPG-Encrypted-Files-in-SAS/m-p/462320#M117694</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-05-15T12:23:07Z</dc:date>
    </item>
    <item>
      <title>Re: GPG Files Readin in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-in-GPG-Encrypted-Files-in-SAS/m-p/462326#M117698</link>
      <description>&lt;P&gt;Yep.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have changed it to&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FILENAME READER PIPE "gpg --decrypt-files &amp;amp;PATH.\Rawdata\&amp;amp;FILE..txt.gpg";&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;DATA &amp;amp;LIB..&amp;amp;DSN. (COMPRESS=YES) ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;%LET _EFIERR_ = 0; /* set the ERROR detection macro variable */&lt;/FONT&gt;&lt;BR /&gt;&lt;STRONG&gt;INFILE READER DELIMITER = '|' TRUNCOVER DSD LRECL=32767 FIRSTOBS=1;&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I see that the file is decrypted in my folder but no SAS is not reading in.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Log says&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Stderr output:&lt;BR /&gt;gpg: AES encrypted data&lt;BR /&gt;gpg: encrypted with 1 passphrase&lt;BR /&gt;NOTE: 0 records were read from the infile READER.&lt;BR /&gt;NOTE: The data set RSASDATA.T3 has 0 observations and 69 variables.&lt;/P&gt;</description>
      <pubDate>Tue, 15 May 2018 12:41:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-in-GPG-Encrypted-Files-in-SAS/m-p/462326#M117698</guid>
      <dc:creator>Konakanchi</dc:creator>
      <dc:date>2018-05-15T12:41:06Z</dc:date>
    </item>
    <item>
      <title>Re: GPG Files Readin in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-in-GPG-Encrypted-Files-in-SAS/m-p/462555#M117784</link>
      <description>The --decrypt-files option doens't write clear text into the stdout. Its working with files.&lt;BR /&gt;&lt;BR /&gt;# Make a clear text message in a file&lt;BR /&gt;$ echo message1 &amp;gt; clear1&lt;BR /&gt;&lt;BR /&gt;# Encrypt it&lt;BR /&gt;$ gpg -c clear1&lt;BR /&gt;&lt;BR /&gt;# Decrypt it&lt;BR /&gt;$ gpg --decrypt-files clear1.gpg &lt;BR /&gt;gpg: AES encrypted data&lt;BR /&gt;gpg: encrypted with 1 passphrase&lt;BR /&gt;File 'clear1' exists. Overwrite? (y/N) &lt;BR /&gt;Enter new filename: &lt;BR /&gt;gpg: signal Interrupt caught ... exiting&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Note the gpg command is prompting and working with files. Its not piping the cleartext message into stdout which is what SAS is expecting to read from when you use a pipe.&lt;BR /&gt;&lt;BR /&gt;If you want to do it with files then run the GPG decrypt with an X statement and read the cleartext from the output file in the normal way.&lt;BR /&gt;&lt;BR /&gt;This isn't any issue with your SAS code but rather what you have typed into the filename pipe statement to be run. You'll need to work out what options gnupg needs on the command line to stream the clear text into stdout from cipher text stored on disk.</description>
      <pubDate>Wed, 16 May 2018 04:28:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-in-GPG-Encrypted-Files-in-SAS/m-p/462555#M117784</guid>
      <dc:creator>SimonDawson</dc:creator>
      <dc:date>2018-05-16T04:28:41Z</dc:date>
    </item>
    <item>
      <title>Re: GPG Files Readin in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-in-GPG-Encrypted-Files-in-SAS/m-p/462561#M117785</link>
      <description>&lt;P&gt;if you use&lt;/P&gt;
&lt;PRE&gt;--decrypt file.gpg&lt;/PRE&gt;
&lt;P&gt;instead of&lt;/P&gt;
&lt;PRE&gt;--decrypt-files file.gpg&lt;/PRE&gt;
&lt;P&gt;the result will be written to stdout, so you can capture it with the filename pipe.&lt;/P&gt;
&lt;P&gt;(retrieved from the first hit of a google search for "man gpg"; Maxim 1 is also valid for UNIX commands)&lt;/P&gt;</description>
      <pubDate>Wed, 16 May 2018 06:10:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-in-GPG-Encrypted-Files-in-SAS/m-p/462561#M117785</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-05-16T06:10:59Z</dc:date>
    </item>
    <item>
      <title>Re: GPG Files Readin in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-in-GPG-Encrypted-Files-in-SAS/m-p/462936#M117882</link>
      <description>&lt;P&gt;Worked. Thanks. However, I have another doubt. My gpg file as a gzip file , within which there is a text file. The text file needs to be imported into SAS. My code which has worked based on your suggestions to read a pgp encrypted text file was&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FILENAME READER PIPE "gpg --decrypt &amp;amp;PATH.\Rawdata\Test3.txt.gpg";&lt;/P&gt;&lt;P&gt;DATA &amp;amp;LIB..&amp;amp;DSN. (COMPRESS=YES) ;&lt;BR /&gt;%LET _EFIERR_ = 0; /* set the ERROR detection macro variable */&lt;BR /&gt;INFILE READER DELIMITER = '|' TRUNCOVER DSD LRECL=32767 FIRSTOBS=1 OBS=10;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where can i add the command to extract text file from gzip here?&lt;/P&gt;</description>
      <pubDate>Thu, 17 May 2018 06:39:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-in-GPG-Encrypted-Files-in-SAS/m-p/462936#M117882</guid>
      <dc:creator>Konakanchi</dc:creator>
      <dc:date>2018-05-17T06:39:21Z</dc:date>
    </item>
    <item>
      <title>Re: GPG Files Readin in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-in-GPG-Encrypted-Files-in-SAS/m-p/462939#M117883</link>
      <description>&lt;P&gt;So you have a file that was probably created with something like&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;gzip -c file.txt|gpg&amp;gt;file.txt.gpg&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(I've omitted the gpg options for accepting stdin and writing to stdout)&lt;/P&gt;
&lt;P&gt;So it is text compressed with gzip encrypted with gpg.&lt;/P&gt;
&lt;P&gt;To read that, you need to unravel everything in the reverse order of its creation:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename reader pipe "gpg --decrypt &amp;amp;PATH.\Rawdata\Test3.txt.gpg|gzip -dc";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So the decrypted stream is fed to gzip, which is told by the parameters to decompress and write to standard output; since no filename is given, gzip will read from stdin and therefore the pipe from gpg.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;An alternative would be to decrypt to a file first, and then read that with filename zip with the gzip option.&lt;/P&gt;</description>
      <pubDate>Thu, 17 May 2018 07:02:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-in-GPG-Encrypted-Files-in-SAS/m-p/462939#M117883</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-05-17T07:02:01Z</dc:date>
    </item>
  </channel>
</rss>

