BookmarkSubscribeRSS Feed
Doc
Calcite | Level 5 Doc
Calcite | Level 5
Good morning,

Not use if this is the right forum, but I will try anyway.


I a very new to SAS, so please bear with me. I am taking the Tutorial lessons, but need to do a few things asap.

I have created a SAS library I call VM. A colleauge has emailed me a SAS dataset called exer and a SAS Proram file called exerP. I have moved these 2 files into a folder I call SAS. I would like move thee files into my sas Library so I can access them from SAS.

Could someone please tell me how to do this.

Thank you.

sorry for such a naive question
5 REPLIES 5
Peter_C
Rhodochrosite | Level 12
in your SAS session, use a libname statement and a filename statement pointing to the sas folder.
that's all you need!

good luck

PeterC
Doc
Calcite | Level 5 Doc
Calcite | Level 5
Thank you Peter C.

I am such a noob! Could you write for me a sample of the code? i really would appreciated it.

Thanks again
Peter_C
Rhodochrosite | Level 12
libname mylib 'your/path/to/your/folder/sas';

filename statement is very similar.
are you you using learning edition, enterprise guide or SASdIsplay Manager?

peterc
Cynthia_sas
SAS Super FREQ
Hi:
How did you create your library called "VM"???? Did you use a LIBNAME statement??? How are you accessing SAS -- via EG, using SAS Display Manager, or writing code and then doing batch submits via a command line command?

Let's say, for the sake of argument, that you are using SAS Display Manager and the Enhanced Editor for program submission. If you used a LIBNAME statement to point to the VM library and you pointed your LIBNAME statement to a physical directory called: c:\doc\mydata -- then your LIBNAME statement probably looked something like this:
[pre]
libname VM 'c:\doc\mydata';
[/pre]

If you used point and click windows, then the appropriate LIBNAME statement was issued for you behind the scenes.

You have 2 choices for working with the file your colleague sent you. Most SAS datasets on Windows and Unix have a file extension of .SAS7BDAT -- so these are your choices:
1) move/copy EXER.SAS7BDAT into c:\doc\mydata directory (or whatever real physical location you used for the library that you called 'VM')
or
2) put EXER.SAS7BDAT into another directory (like c:\temp) and just point to it with another LIBNAME statement:

[pre]
libname mydata 'c:\temp';
[/pre]

If you took choice #1, and put the data in the 'VM' location, then you would subsequently refer to the data with a 2 level name, VM.EXER; if you took choice #2, then you would subsequently refer to the data with a -different- 2 level name, MYDATA.EXER -- note how the "nickname" or library reference (either VM or MYDATA) identifies the library location for the data. Consider this PROC PRINT:
[pre]
proc print data=libref.dataset;
run;
would be:
1) proc print data=VM.EXER;
2) proc print data=MYDATA.EXER;
[/pre]


If you are using SAS Enterprise Guide, then you might want to look in the EG help for how to define and access data (because EG has a method for you to point to the data without worrying about the LIBNAME statement).

As for your .SAS file -- the program file. That file is just an ASCII text file. It does NOT have to be in the same library with the data. Of course, it's handy to have the code in the same physical location as the data. However, you access the program by issuing FILE --> OPEN commands -- so it really doesn't matter where the file is, you can open and include it it into your Editor or EG code node.

By default, on Windows, your "working directory" is someplace in C:\Documents and Settings -- you don't have to keep this as your working directory, but one thing you could do is put your .SAS program into this working directory instead of storing it in the physical directory with the data -- your choice. My tendency is to keep everything together while I'm testing or developing and then once the programs are working as I want, I put the programs in one directory, the data in a separate directory and the output in a third directory. You could start out with this method of working. I like to do it after, because it forces me to make one last pass through the programs and data to make sure that I have -everything- organized.

If you are working through the SAS tutorial, it was my memory that most of this information was contained in the tutorial. Of course, if you are doing an EG tutorial, then that would refer to EG windows, instead of Display Manager concepts.

This documentation describes the SAS environment and the process of submitting a program in Display Manager and using SAS Libraries:
http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/a001304302.htm
http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/a001360654.htm
http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/a001786394.htm
http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/a001612707.htm

Good luck.

cynthia
Doc
Calcite | Level 5 Doc
Calcite | Level 5
WOW!

Thank you so much for your detailed help.

I am using SAS 9.1.3 with service pack 4

I used point and click to create the VM Library and am using the Program editor to move the files into that library.

I do have SAS enterprise on my system, but I do not think i am using that.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 806 views
  • 0 likes
  • 3 in conversation