<?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: read csv file in sas 9.4 from python in Developers</title>
    <link>https://communities.sas.com/t5/Developers/read-csv-file-in-sas-9-4-from-python/m-p/545284#M171</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/200312"&gt;@Srigyan&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;FONT color="#3366FF"&gt;I wanted to read a csv&amp;nbsp;file which is saved in sas 9.4.&lt;/FONT&gt; Just wanted to confirm i dont&amp;nbsp;want to import sas&amp;nbsp;data in python first then read it.&lt;/P&gt;
&lt;P&gt;I want to read the csv&amp;nbsp;file directly.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The blue marked sentence does not make much sense.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In SAS csv-files are read by data-step (or by proc import, but this i can't recommend).&lt;/P&gt;</description>
    <pubDate>Fri, 22 Mar 2019 16:26:21 GMT</pubDate>
    <dc:creator>andreas_lds</dc:creator>
    <dc:date>2019-03-22T16:26:21Z</dc:date>
    <item>
      <title>read csv file in sas 9.4 from python</title>
      <link>https://communities.sas.com/t5/Developers/read-csv-file-in-sas-9-4-from-python/m-p/545280#M170</link>
      <description>&lt;P&gt;I wanted to read a csv&amp;nbsp;file which is saved in sas 9.4. Just wanted to confirm i dont&amp;nbsp;want to import sas&amp;nbsp;data in python first then read it.&lt;/P&gt;&lt;P&gt;I want to read the csv&amp;nbsp;file directly.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Mar 2019 16:17:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/read-csv-file-in-sas-9-4-from-python/m-p/545280#M170</guid>
      <dc:creator>Srigyan</dc:creator>
      <dc:date>2019-03-22T16:17:49Z</dc:date>
    </item>
    <item>
      <title>Re: read csv file in sas 9.4 from python</title>
      <link>https://communities.sas.com/t5/Developers/read-csv-file-in-sas-9-4-from-python/m-p/545284#M171</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/200312"&gt;@Srigyan&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;FONT color="#3366FF"&gt;I wanted to read a csv&amp;nbsp;file which is saved in sas 9.4.&lt;/FONT&gt; Just wanted to confirm i dont&amp;nbsp;want to import sas&amp;nbsp;data in python first then read it.&lt;/P&gt;
&lt;P&gt;I want to read the csv&amp;nbsp;file directly.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The blue marked sentence does not make much sense.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In SAS csv-files are read by data-step (or by proc import, but this i can't recommend).&lt;/P&gt;</description>
      <pubDate>Fri, 22 Mar 2019 16:26:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/read-csv-file-in-sas-9-4-from-python/m-p/545284#M171</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-03-22T16:26:21Z</dc:date>
    </item>
    <item>
      <title>Re: read csv file in sas 9.4 from python</title>
      <link>https://communities.sas.com/t5/Developers/read-csv-file-in-sas-9-4-from-python/m-p/545301#M172</link>
      <description>&lt;P&gt;I would think you would want to write out your SAS dataset as a csv, then read it in using python. Not sure if I'm missing something.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Mar 2019 16:54:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/read-csv-file-in-sas-9-4-from-python/m-p/545301#M172</guid>
      <dc:creator>noling</dc:creator>
      <dc:date>2019-03-22T16:54:51Z</dc:date>
    </item>
    <item>
      <title>Re: read csv file in sas 9.4 from python</title>
      <link>https://communities.sas.com/t5/Developers/read-csv-file-in-sas-9-4-from-python/m-p/545302#M173</link>
      <description>&lt;P&gt;SAS doesn't really store CSVs. It would be on a network drive or server somewhere instead and you would have the same acesss.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It could be on the SAS server, but that can be treated as a drive for CSV files.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/200312"&gt;@Srigyan&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I wanted to read a csv&amp;nbsp;file which is saved in sas 9.4. Just wanted to confirm i dont&amp;nbsp;want to import sas&amp;nbsp;data in python first then read it.&lt;/P&gt;
&lt;P&gt;I want to read the csv&amp;nbsp;file directly.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Mar 2019 16:55:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/read-csv-file-in-sas-9-4-from-python/m-p/545302#M173</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-03-22T16:55:03Z</dc:date>
    </item>
    <item>
      <title>Re: read csv file in sas 9.4 from python</title>
      <link>https://communities.sas.com/t5/Developers/read-csv-file-in-sas-9-4-from-python/m-p/545312#M174</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/200312"&gt;@Srigyan&lt;/a&gt;&amp;nbsp; I wanted to read a csv file which is saved in sas 9.4. Just wanted to confirm i dont want to import sas data in python first then read it.
I want to read the csv file directly.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I think what you are says is&lt;/P&gt;
&lt;P&gt;I want to read a csv file that is created through a SAS 9.4 process.&amp;nbsp; I just want to confirm if I can read the csv file into Python or can I read into SAS a csv file created by Python.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes CSV is not SAS nor Python required to read.&amp;nbsp; You can even import a csv file into Excel.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Mar 2019 17:09:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/read-csv-file-in-sas-9-4-from-python/m-p/545312#M174</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2019-03-22T17:09:14Z</dc:date>
    </item>
    <item>
      <title>Re: read csv file in sas 9.4 from python</title>
      <link>https://communities.sas.com/t5/Developers/read-csv-file-in-sas-9-4-from-python/m-p/545323#M175</link>
      <description>&lt;P&gt;Python can read a CSV file.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But note that a CSV file does not contain ANY metadata about the columns, other than the optional header row.&lt;/P&gt;
&lt;P&gt;So your program in Python will have to know how to treat the columns in the CSV file or else you can get stupid things like character variables being interpreted as numeric just because the values in this particular file happen to look like numbers written as strings.&amp;nbsp; So if you have a character variable with leading zeros then they might be lost if treated as a number.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A SAS dataset does contain information about the columns, like whether it is text of a number, a longer SAS label in addition to the variable name. Also the SAS metadata on format and informat.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Mar 2019 17:35:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/read-csv-file-in-sas-9-4-from-python/m-p/545323#M175</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-03-22T17:35:15Z</dc:date>
    </item>
    <item>
      <title>Re: read csv file in sas 9.4 from python</title>
      <link>https://communities.sas.com/t5/Developers/read-csv-file-in-sas-9-4-from-python/m-p/545397#M176</link>
      <description>&lt;P&gt;Yes, you are correct&lt;/P&gt;</description>
      <pubDate>Sat, 23 Mar 2019 00:30:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/read-csv-file-in-sas-9-4-from-python/m-p/545397#M176</guid>
      <dc:creator>Srigyan</dc:creator>
      <dc:date>2019-03-23T00:30:39Z</dc:date>
    </item>
    <item>
      <title>Re: read csv file in sas 9.4 from python</title>
      <link>https://communities.sas.com/t5/Developers/read-csv-file-in-sas-9-4-from-python/m-p/545398#M177</link>
      <description>&lt;P&gt;When I say sas9.4 it means data are stored on sas server which is actually Linux environment but you are running python on window environment. Saspy can upload this csv in python then read it. But I am not aware of it can read it without uploading in python.&lt;/P&gt;</description>
      <pubDate>Sat, 23 Mar 2019 00:34:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/read-csv-file-in-sas-9-4-from-python/m-p/545398#M177</guid>
      <dc:creator>Srigyan</dc:creator>
      <dc:date>2019-03-23T00:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: read csv file in sas 9.4 from python</title>
      <link>https://communities.sas.com/t5/Developers/read-csv-file-in-sas-9-4-from-python/m-p/545399#M178</link>
      <description>&lt;P&gt;To communicate with sas 9.4 python have saspy but unfortunately it can't read csv without uploading this in python. So is there any way... Just to reiterate sas 9.4 have it's own server which is not window, in my case Linux but python runs on Windows, hope now you understand the complexity of this question&lt;/P&gt;</description>
      <pubDate>Sat, 23 Mar 2019 00:38:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/read-csv-file-in-sas-9-4-from-python/m-p/545399#M178</guid>
      <dc:creator>Srigyan</dc:creator>
      <dc:date>2019-03-23T00:38:29Z</dc:date>
    </item>
    <item>
      <title>Re: read csv file in sas 9.4 from python</title>
      <link>https://communities.sas.com/t5/Developers/read-csv-file-in-sas-9-4-from-python/m-p/545400#M179</link>
      <description>You may want to contact tech support. I don't understand your question and SASpy and integration with python is pretty new and it seems like it's going to depend a lot on your set up. &lt;BR /&gt;&lt;BR /&gt;If python doesn't have access to the server, that's not a SAS or Python issue, it's a set up issue.</description>
      <pubDate>Sat, 23 Mar 2019 00:41:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/read-csv-file-in-sas-9-4-from-python/m-p/545400#M179</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-03-23T00:41:10Z</dc:date>
    </item>
    <item>
      <title>Re: read csv file in sas 9.4 from python</title>
      <link>https://communities.sas.com/t5/Developers/read-csv-file-in-sas-9-4-from-python/m-p/545401#M180</link>
      <description>Reading your responses to others, this is sounding more and more like a set up of your network type issue, not a programming issue. If your python can't see the server that's something that needs to get fixed. Within SAS there are multiple methods of moving files, so you could move the file if that was allowed, but it wouldn't really be any different than reading it directly from the server. And all of these depend on set up so you need to talk to your IT team.</description>
      <pubDate>Sat, 23 Mar 2019 00:43:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/read-csv-file-in-sas-9-4-from-python/m-p/545401#M180</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-03-23T00:43:33Z</dc:date>
    </item>
    <item>
      <title>Re: read csv file in sas 9.4 from python</title>
      <link>https://communities.sas.com/t5/Developers/read-csv-file-in-sas-9-4-from-python/m-p/545407#M181</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/200312"&gt;@Srigyan&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;When I say sas9.4 it means data are stored on sas server which is actually Linux environment but you are running python on window environment. Saspy can upload this csv in python then read it. But I am not aware of it can read it without uploading in python.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/200312"&gt;@Srigyan&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To express what you write a bit differently:&lt;/P&gt;
&lt;P&gt;1. You have a .csv saved on a file system that is accessible via a SAS Server you can connect to&lt;/P&gt;
&lt;P&gt;2. You have Python available to you on your local Windows PC&lt;/P&gt;
&lt;P&gt;3. You can't access the file system where the .csv is stored directly from your Windows PC&lt;/P&gt;
&lt;P&gt;4. You don't really want to use SAS. You just want to process the .csv using your local instance of Python&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If above is correct then this has nothing to do with SAS as such. What you need is a way to either map the remote file system to your local PC or you just need to download the .csv to your local environment.&lt;/P&gt;
&lt;P&gt;If this is a one off task then for downloading: If you have something like WinSCP installed locally then use this client to download the .csv. If you don't know how this works then contact your IT department/SAS Admin to help you with this.&lt;/P&gt;</description>
      <pubDate>Sat, 23 Mar 2019 01:35:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/read-csv-file-in-sas-9-4-from-python/m-p/545407#M181</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-03-23T01:35:46Z</dc:date>
    </item>
    <item>
      <title>Re: read csv file in sas 9.4 from python</title>
      <link>https://communities.sas.com/t5/Developers/read-csv-file-in-sas-9-4-from-python/m-p/546611#M182</link>
      <description>&lt;P&gt;It he following what you are trying to do? If not which parts are not right?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) you have python, and saspy, on your local windows.&lt;/P&gt;
&lt;P&gt;2) SAS is remote on Linux.&lt;/P&gt;
&lt;P&gt;3) you have a local .csv file on your windows machine&lt;/P&gt;
&lt;P&gt;4) you want SAS on the remote Linux to actually read in the .csv file&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The above can be accomplished with the current version of saspy (2.4.4) like so...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;import saspy&lt;/P&gt;
&lt;P&gt;sas = saspy.SASsession()&lt;/P&gt;
&lt;P&gt;sas&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;res = sas.upload('c:\\local_csv_file.csv', sas.workpath)&amp;nbsp; &amp;nbsp;# you should have access to write to work&lt;/P&gt;
&lt;P&gt;# or to any directory&amp;nbsp; &amp;nbsp;&amp;nbsp;res = sas.upload('c:\local_csv_file.csv', '/whatever/directory/you/can/write/to')&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;sascsv = sas.read_csv(sas.workpath+'local_csv_file.csv')&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;# or&amp;nbsp; &amp;nbsp;sascsv = sas.read_csv(/whatever/directory/you/can/write/to/local_csv_file.csv')&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;sascsv.head()&amp;nbsp; # sascsv is the SASdata opbject for the new SAS data set&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the signature, so you can specify the libref and table name and other things too&lt;/P&gt;
&lt;P&gt;&lt;CODE class="descname"&gt;read_csv&lt;/CODE&gt;&lt;SPAN class="sig-paren"&gt;(&lt;/SPAN&gt;&lt;EM&gt;file: str&lt;/EM&gt;&lt;SPAN&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;table: str = '_csv'&lt;/EM&gt;&lt;SPAN&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;libref: str = ''&lt;/EM&gt;&lt;SPAN&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;results: str = ''&lt;/EM&gt;&lt;SPAN&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;opts: dict = None&lt;/EM&gt;&lt;SPAN class="sig-paren"&gt;)&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;→ saspy.sasdata.SASdata&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can name the file something different on the remote system too, just specify the full path and file name on upload:&lt;/P&gt;
&lt;P&gt;#&amp;nbsp;res = sas.upload('c:\local_csv_file.csv', '/whatever/directory/you/can/write/to/remote.csv')&lt;/P&gt;
&lt;P&gt;#&amp;nbsp;sascsv = sas.read_csv(/whatever/directory/you/can/write/to/remote.csv')&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is this what you&amp;nbsp; are looking to do?&amp;nbsp; (I hand typed that in, so forgive me if there's a typo)&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;</description>
      <pubDate>Wed, 27 Mar 2019 17:30:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/read-csv-file-in-sas-9-4-from-python/m-p/546611#M182</guid>
      <dc:creator>sastpw</dc:creator>
      <dc:date>2019-03-27T17:30:46Z</dc:date>
    </item>
    <item>
      <title>Re: read csv file in sas 9.4 from python</title>
      <link>https://communities.sas.com/t5/Developers/read-csv-file-in-sas-9-4-from-python/m-p/551868#M322</link>
      <description>&lt;P&gt;Was this what you were trying to do? Were you able to accomplish it? Or was there something different with your scenario?&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2019 19:30:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/read-csv-file-in-sas-9-4-from-python/m-p/551868#M322</guid>
      <dc:creator>sastpw</dc:creator>
      <dc:date>2019-04-17T19:30:31Z</dc:date>
    </item>
  </channel>
</rss>

