SAS Enterprise Guide - How can I download a ZIP file from a website, extract its contents and run it? - sas

I would like to have a task to download a continuously updated .ZIP data file from a specific website, extract its contents and run the file inside.
I am looking for a program code that performs these tasks and, so to speak, if the data on the website is updated, then my data file is also updated with it.
How can I do it?
Please help!
SAS Enterprise Guide 8.2
I didn't find a solution for it.

Read Chris method here for reading a zip file using filename statement: https://blogs.sas.com/content/sasdummy/2014/01/29/using-filename-zip/
Chris is the community director at SAS (something like that). A zip file will be locked on an update. Check the file date and store the date somewhere so you can see if it changed.
There are lots of ways to approach your problem and I dont know your constraints. Start with Chris' post and work from there.

You could download the zip using proc http
This macro will let you unzip it: https://core.sasjs.io/mp__unzip_8sas.html
And this macro will give you the recursive directory contents: https://core.sasjs.io/mp__tree_8sas.html

Related

SAS Enterprise Guide - Get Code from Process flow

I was wondering if there is a easy and fast way to get the code from the programs that I have created in SAS Enterprise Guides process flow?
I am creating the program in SAS Enterprise Guide, and then creating a script for later usage in SAS, as I am not strong enough to program it from scratch.
At the moment, I am opening each step and copying the code, but there must be a faster way.
Any suggestions?
Thanks
This is an option in the File menu:
File -> Export -> Export all Code in Process Flow
If you rename the file from an EGP to a .zip and then open the file you'll see you have folders relating to objects in the EG project.
You can then pull extract these pieces of SAS code and rename as necessary.
I've also seen some software which can examine EGP files if you do a search.
This has been updated instead of File -> Export -> Export all Code in Process Flow.
You can find this under the Share button in the Process Flow tab.
Share -> Export all Code in Process Flow

cPickle.load() doesnt accept non-.gz files, what can I use for .pkl files?

I am trying to run an example of a LSTM recurrent neural network that is presented in this git: https://github.com/mesnilgr/is13.
I've installed theano and everything and when I got to the point of running the code, I've noticed the data was not being downloaded, so I've opened an issue on the github (https://github.com/mesnilgr/is13/issues/12) and this guy came up with a solution that consisted in:
1-get the data from the dropbox link he provides.
2- change the code of the 'load.py' file to download, and read the data properly.
The only issue is that the data in the dropbox folder(https://www.dropbox.com/s/3lxl9jsbw0j7h8a/atis.pkl?dl=0) is not a compacted .gz file as, I suppose, was the data from the original repository. So I dont have enough skill to change the code in order to do with the uncompressed data exaclty what it would do with the compressed one. Can someone help me?
The modification suggested and the changes I've done are described on the issue I've opened on the git(https://github.com/mesnilgr/is13/issues/12).
It looks like your code is using
gzip.open(...)
But if the file is not gzipped then you probably just need to remove the gzip. prefix and use
open(...)

Copy files from local PC to SAS server in Enterprise Guide

I need to extract a particular sheet from a .xls file on my local machine and get it as a .sas7bdat files on the SAS server on which I work (or the other way round, that is, import it and then convert).
The problem is that although this can be done using the Import Wizard, I need to do this using the 'Copy Files Add-in' because it needs to be built as a part of an automated process.
When I tried doing this using the copy files add-in, it DID copy the .xls file onto the server according to the log, but the .xls file didn't actually show in the library and could not be referenced either (or maybe I'm just referencing it wrongly).
This has led me to believe that I need to convert it to a .sas7bdat and then import it.
Is there a way to get past this? Please bear in mind that I am talking about an automated process, so the wizard is useless for me (or is it? I'm not sure)
NOTE : I am extremely sorry that I cannot post the log and screenshots here, because I work as an offshore resource for a very large bank and cannot post anything here. I have, however, tried to make my problem as clear as possible. If any further clarifications are needed, please let me know!
I assume you've read There and Back Again which covers this in some detail.
Ultimately, all you're doing is copying the excel file as a file onto the SAS server. You're not importing it into a SAS dataset. You would import it by placing the file (either the remote file after copy files add-in, or the local file) in the workflow as an import step.
For example, if you chose /usr/lib/sasdata/myexcel.xls as the remote copy destination, you then need to include that file in your workflow as an import step (you can drag/drop the file and it will automatically create that step for you, with some wizardry).

What is the database for GeoIP.h

In one open source project, I saw that they were including GeoIP.h header file and calling their functions to know the country code of an IP. I wonder where is the database used by GeoIP.h
I went through the source code of GeoIP.h at
http://www9.biostr.washington.edu/webalizer/src/stonesteps.ca/webalizer_src_3_4_4_1/GeoIP.h
It uses a variable FILE *GeoIPDatabase; Please suggest. I need the whole database.
===EDIT===
The source code I am visiting is this. It doesn't mention any database to be used!
https://github.com/lampeh/libvmod-geoip/blob/master/src/vmod_geoip.c.
It's available for download on the Maxmind web site. A basic free version is available at:
http://dev.maxmind.com/geoip/legacy/geolite/
More detailed databases are also available for purchase.
Are you looking for this? (see downloads section)
http://dev.maxmind.com/geoip/legacy/geolite/
You can download either CSV or binary data files.

how can i read datasets in Weka?

I want to use some of the datasets available at the website of the Weka to perform some
experiments with Neural Networks.
What do I have to do to read the data?
I downloaded the datasets and they were saved as .arff.txt so I deleted the extension of .txt to have only .arff. So I used this file as an ipnut but an error occurs.
Which is the right way to read data?
Do I have to write code?
Please help me.
Thank you
I'm using Weka 3.6.6 and coc81.arff opens just fine. You are using Weka 3.7.x, which is the development branch of Weka. I suggest that you download 3.6.6 or 3.6.7 (the latest stable release) and try to open the file again.
There is also another simple throw...
open your dataset file in excel in my case MS Excel2010, format fields intype.
and save as 'csv',
then reload that csv file in the weka explorer and save on the local drive as arff format.
may be this help.