Feb
19
SAS studio – dude, where’s my data set?
February 19, 2017 | Leave a Comment
Working on some fun things using SAS Studio, so, expect a number of short posts over the next few days. Last time, I talked about the utilities and how easy it is to import an Excel file. Now let’s say maybe you are not aUnix person and you have no idea how exactly to code a LIBNAME statement that is not on Windows. Never fear, it’s super easy.
Right click on the folder where you want to save your data set. From the menu that appears, select the last choice which is ‘properties’.
A window will come up that shows the name of your folder and its location, it’s easy to spot because it’s right next to the word Location. It will look something like this:
/home/your_name/data_analysis_examples
to save your data you have uploaded an Excel file and imported into SAS, remember that the files were saved in the work directory and named import, import 1 etc.If I wanted to sort those data sets and then merge them together into a permanent data set, I’d do it in the exact same way as if I was using Windows. The only thing different is the LIBNAME statement, as you can see below.
LIBNAME in “/home/your_name/data_analysis_examples”;
Proc sort data = work.import;
By username;
Proc sort data = work.import1;
By username;
data in.crossroads ;
merge work.import work.import1;
By username;
run;
If, later on, I want to use that data set in a program, again I would do it exactly the same as in Windows and the only thing different would be my LIBNAME.
LIBNAME in “/home/your_name/data_analysis_examples”;
Proc means data = in.Crossroads;
Run;
Completely random fact, unrelated to SAS studio, or maybe it is related, I hurt my arm again, so I have been writing my SAS programs using Dragon voice recognition software. If you are going to use SAS studio on a Mac, you should be aware that Dragon does not work on Firefox on the Mac so open up Chrome if you want to use voice recognition software, or at least the software from Dragon. This has nothing to do with SAS specifically.
Feb
7
SAS Studio – Import Excel with Tasks & Utilities
February 7, 2017 | 3 Comments
It’s been about a year since I last looked at SAS Studio much –
OKAY, LISTEN UP PEOPLE
In my previous life, I taught for years at a small liberal arts college, with under 2,000 students. I also taught at a tribal community college with less than 500 students. In neither of those situations did we have the funding to pay for expensive software. SAS Studio is FREE. I could have really used this when I was teaching at those small schools. Check it out.
So, it’s free, but I don’t teach that often because I have a day job as president of The Julia Group where clients want me to do some much stuff we quit taking new clients years ago and also president of 7 Generation Games where they want me to do more stuff.
The last class I taught, we used SAS on a remote desktop – which I liked a lot. So, yes, no SAS Studio for me for a while.
In case, like me, you are more a programming type and haven’t been too pointy-clicky, perhaps you missed the TASKS AND UTILITIES. Well, don’t.
Let’s say you want to import a file from Excel into SAS. First, upload it by clicking on the folder where you want it stored and then clicking the upload button at the top left of your screen.
Look to the bottom left of your screen and you will see this. Well, you’ll see the Tasks and Utilities anyway, the stuff above it is files for class examples.
Click on the arrow next to Tasks and Utilities and you’ll find all kinds of cool stuff. Click the arrow next to utilities and pick IMPORT DATA
Drag the file you uploaded into the window on the right and, voila!
There you go, your Excel file is imported into SAS. You can see the code in the CODE window. DON’T FORGET TO CLICK THE LITTLE RUNNING GUY AT THE TOP OF YOUR SCREEN TO RUN THIS.
Note that the file is named WORK.IMPORT because you’ll need that name for the next task, but that’s next time because I have to go back to work.
/* Generated Code (IMPORT) */
/* Source File: testit.xlsx */
/* Source Path: /home/annmaria.demars/homework */
/* Code generated on: 2/6/17, 11:27 PM */
%web_drop_table(WORK.IMPORT);
FILENAME REFFILE ‘/home/annmaria.demars/homework/testit.xlsx’;
PROC IMPORT DATAFILE=REFFILE
DBMS=XLSX
OUT=WORK.IMPORT;
GETNAMES=YES;
RUN;
PROC CONTENTS DATA=WORK.IMPORT; RUN;
%web_open_table(WORK.IMPORT);
SAS nicely runs the PROC CONTENTS, too, so you end up with a table telling you the contents of your new data set.
Once you have your data imported, you can use the TASKS menu to complete (what else) statistical tasks. I wrote about those in some other posts below:
My point is, there is a lot of stuff under that little tab and you should check it out. Also, if you are a small school, SAS Studio is an awesome resource you can get for free and I bet you could use it.
Support my day job! Learn about Ojibwe history and culture. Practice multiplication and division
FREE GAME FOR iPad or Android tablets
Click over here to find links to Making Camp in the App Store or on Google Play. Yes, it’s free.
Blogroll
- Andrew Gelman's statistics blog - is far more interesting than the name
- Biological research made interesting
- Interesting economics blog
- Love Stats Blog - How can you not love a market research blog with a name like that?
- Me, twitter - Thoughts on stats
- SAS Blog for the rest of us - Not as funny as some, but twice as smart. If this is for the rest of us, who are those other people?
- Simply Statistics, simply interesting
- Tech News that Doesn’t Suck
- The Endeavor -John D Cook - Another statistics blog