Libref | MYDATA |
---|---|
Engine | V9 |
Physical Name | /folders/myfolders |
Filename | /folders/myfolders |
Inode Number | 5285176 |
Access Permission | rwxr-xr-x |
Owner Name | UNKNOWN |
File Size | 3KB |
File Size (bytes) | 2720 |
I created a library called mydata, how do I import data into it so I can start running analyses? (Also, why is this so hard?) OK, don't need to answer that second question. I'm using SAS University, so are there some limitations I'm bumping against -- maybe it does not allow data to be read into it?
Thanks. New User. Previously used another stats system where this was, well, astonishingly easy, but my school has urged me to use SAS, and so I'm stuck on these basic things.
1. Assign a library - in SAS a library is a directory that you can use to save files. You reference data sets via LIBNAME.DATASETNAME. If you assign the libname by clicking the cabinet icon under Server/Folders you can select an option for the library to stay assigned between sessions of SAS UE. Otherwise you can add the relevant line to your code each time.
libname mylib '/folders/myfolders';
2. Import your CSV to SAS dataset.
proc import out=mylib.mydata datafile='/folders/myfolders/test.csv' dbms=CSV replace;
run;
3. Data set is in the library - permanently. If you want to reference it in future programs, assign the libname and go to town.
proc print data=mylib.mydata;
run;
4. Your file is ready for analysis in procs
proc freq data=mylib.mydata;
table _all_;
run;
proc means data=mylib.mydata;
run;
Okay let us suppose that you have a data set and you added it to the shared folder, so you can see it under the "Server Files And Folders" directly or under another folder.
Then you can use proc import to import your data to your library like _suppose your new data is CSV file and its name is data1_:
proc import datafile="/folders/myfolders/data1.csv"
out=mydata.data1
dbms=csv
replace;
getnames=no;
run;
You need to specify your data file name in the datafile parameters. Then specify your library name in the out parameters with the name you choose for your data.
Hope that help.
Also if you do not like to write the code each time you import new data. You can use import data option in SAS Studio and then edit the code by your library name.
Thanks. When I tried suggested code:
"Test" is the name of my data file, so I'm pretty sure I can't remove it and actually access the file, because then my code would not have the name of the file it is tyring to access.
I actually figured out a work-around: 1) Import CSV file into My Folders (easy); 2) Under Output Data select Change button; 3) Save As allows you to save file in Work folder in Libraries with distinct name; 4) Run statistics from table in Work folder.
I realize that this will need to be done each time since Work is a temporary folder, but after 5 hours of trying to figure out how to upload a CSV file, it's nice to run some numbers from my data.
If anyone has a solution to my original problem, how to actualy get a CSV File into the Library, I'm listening, but for now I'm OK to run my numbers this way. And again, why does this take more than 30 seconds to figure out?
1. Assign a library - in SAS a library is a directory that you can use to save files. You reference data sets via LIBNAME.DATASETNAME. If you assign the libname by clicking the cabinet icon under Server/Folders you can select an option for the library to stay assigned between sessions of SAS UE. Otherwise you can add the relevant line to your code each time.
libname mylib '/folders/myfolders';
2. Import your CSV to SAS dataset.
proc import out=mylib.mydata datafile='/folders/myfolders/test.csv' dbms=CSV replace;
run;
3. Data set is in the library - permanently. If you want to reference it in future programs, assign the libname and go to town.
proc print data=mylib.mydata;
run;
4. Your file is ready for analysis in procs
proc freq data=mylib.mydata;
table _all_;
run;
proc means data=mylib.mydata;
run;
If i has old datasets means which were created on sas 9.2,how to use them in sas studio.I assigned a library ------>
libname Data '/folders/myfolders/'; but i cant see any datasets which were saved in that folder.I'm attaching a screen shot how my datssets look like in a folder..
Please include screenshots of the Library in SAS Studio
Please show your code and log, including the library assignment and the output from PROC DATASETS
My situation is like this,earlier i used to practice on sas9.2 on windows 32 bit ,as my laptop is not working i moved to other one on which windows 8.1 is installed and it is also a 64 bit platform.I tried to install same sas version i had earlier and failed after that i came to know that there exists some differences between 32 bit and 64 bit.So i moved to sas university version and i copied my datasets on previous computer to folders of sas univ edition via pen drive.so i assigned a library by using libname statment to the same folder where i saved my datsets,but can't see ant datasets inside it.. I'm attching screenshots with a serial number
What happens when you run the following, just paste the log in please, I don't like downloading attachments.
libname myData '/folders/myfolders/';
proc datasets lib=myData;
run;
For example I get:
Libref | MYDATA |
---|---|
Engine | V9 |
Physical Name | /folders/myfolders |
Filename | /folders/myfolders |
Inode Number | 5285176 |
Access Permission | rwxr-xr-x |
Owner Name | UNKNOWN |
File Size | 3KB |
File Size (bytes) | 2720 |
# | Name | Member Type | File Size | Last Modified |
---|---|---|---|---|
1 | CLASS | DATA | 128KB | 2017-05-24 01:58:45 |
2 | CLASS_PERMANENT | DATA | 128KB | 2016-08-20 22:31:13 |
3 | DATEN_EM2012_DUMMIES | DATA | 128KB | 2016-04-21 19:37:04 |
4 | XXXXXXXXXXXXX | DATA | 19MB | 2016-06-10 23:24:25 |
5 | FORMATS | CATALOG | 24KB | 2016-12-29 02:46:21 |
6 | ZZZZZZZZZZZZZZZ | DATA | 832KB | 2016-10-05 04:01:08 |
7 | OUT | DATA | 128KB | 2016-06-16 00:00:35 |
8 | PROSTATECANCER | DATA | 145KB | 2011-01-07 04:25:02 |
9 | SASMACR | CATALOG | 28KB | 2016-09-22 18:51:54 |
Can you upload a dataset?
I'm wondering if the 32/64 bit is the issue. I feel like it shouldn't be, but you may have needed to use PROC XPORT/CPORT to transfer the files properly.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.