[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sas-l
Subject:    Re: Data file
From:       Nat Wooding <nathani () VERIZON ! NET>
Date:       2016-03-25 21:05:01
Message-ID: 003701d186d9$ff9c3eb0$fed4bc10$ () verizon ! net
[Download RAW message or body]

To follow up on this a bit further, the stored data set is treated the same way as \
one that you create during the execution of a job (and it was, indeed, created in a \
job); the difference is that instead of being stored in the Work directory, it was \
stored in an external folder. As Tom showed below in one of the proc contents \
examples, it can be referenced in a Proc step simply by giving the Libref (that is \
what MYLIB in his example is called) followed by the sas name: say, Proc Print data = \
mylib.test;

You should check out the SAS documentation for your operating system for examples of \
working with sas data sets.

Nat

-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Tom Abernathy
Sent: Friday, March 25, 2016 4:56 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: Data file

If it is a SAS dataset then SAS knows the variable names. You can use PROC CONTENTS \
or other tools to find the names. The traditional way is to assign a libref to the \
folder with your SAS datasets and then you can reference all of the datasets in that \
library with the same name.   So you could make a libref named MYLIB using code like \
this.  (Note libref are just aliases to folder(s).  THey must be 8 characters or \
less).

LIBNAME mylib '.../..../';

Then you can refer the dataset TEST as MYLIB.TEST.  Or you could also just refer to \
it by its full physical filename in quotes.

 '.../.../test.sad7dat'

You can use either anywhere you would use a dataset name. So if you want to see the \
variable names you could use :

PROC CONTENTS data=mylib.test; run;
or
PROC CONTENTS data= '.../.../test.sad7dat'; run;

If you want to find the means of all of your numeric variables then use PROC MEANS \
instead.

The only way you could assign the filename to a variable and make much use of it \
later is if you used a MACRO variable.   So you might do something like this:

%let myfile='.../.../test.sad7dat' ;
PROC CONTENTS data=&myfile; run;

or

LIBNAME mylib '.../..../';
%let myfile=mylib.test;
PROC CONTENTS data=&myfile; run;



On Fri, 25 Mar 2016 20:31:09 +0000, Val Krem <valkrem@YAHOO.COM> wrote:

> Thank you Tom,
> 
> if this is  working then is it easy.
> data val;
> set 'test.sas7bat';
> run;
> 
> 
> 
> I am reading it from other source can I assign it like this?
> 
> datval= '.../.../test.sad7dat';
> data val; set datval;
> 
> Does it skip the first row?
> 
> How do i get the variable names? do I have to use proc content?
> 
> 
> 
> 
> 
> 
> On Friday, March 25, 2016 2:57 PM, Tom Abernathy <tom.abernathy@GMAIL.COM> wrote:
> No.  There is nothing to 'IMPORT' about a SAS dataset.  It already is SAS data.
> You can reference a SAS dataset by its physical name (instead of the normal \
> libref.memname syntax) by just including the name in quotes. 
> data val;
> set 'test.sas7bat';
> run;
> 
> On Fri, 25 Mar 2016 19:44:37 +0000, Val Krem <valkrem@YAHOO.COM> wrote:
> 
> > Hi all,
> > 
> > I am trying to import sas data file(test.sas7bdat).
> > 
> > Can I use proc import?
> > 
> > 
> > proc import
> > Datafile='test.sas7bdat'
> > replace
> > out = val; GETNAMES=yes; DATAROW=2;
> > run;
> > 
> > Is not working for me.
> > Can anyone help me out?
> > 
> > Val


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic