Imported dataset

Reply
Frequent Contributor
Posts: 75

Imported dataset

I imported a raw data file into SAS, but I would like to change the way the dataset are input. Can I do so as it is no longer a raw data file?

Thanks

Frequent Contributor
Posts: 106

Re: Imported dataset

Hi Apple,

IF you want to re-arrange the variables in your data set then any of the following statements can be used for that purpose: ATTRIB, ARRAY, FORMAT, INFORMAT, LENGTH, and RETAIN

But these used be used before any SET/MERGE/UPDATE statement in the DATA step.

For Ex:

data test ;

input a b c;

cards;

1 2 3

4 5 6

;

proc print;run;

output:                                         Obs    a    b    c

                                                       1    1    2    3                                       

                                                       2    4    5    6

data test2;

length b 8;

set test;

proc print;run;

output:                                       

                                                   Obs    b    a    c                                       

                                                       1    2    1    3                                       

                                                       2    5    4    6

you can also confirm the change in position of variables through Proc contents.

-Pradeep

Super Contributor
Posts: 644

Re: Imported dataset

You need to tell us what format you want your input data to be in, and what SAS environment you are using:

Some input format examples:

     CSV or Tab delimited files - these are just a special case of 'raw' data files and easily managed depending on your SAS environment.

     Excel - Enterprise Guide has an inport utility, otherwise you need SAS Access to PC File Formats (a separately licensed SAS product)

     ODBC for SQL Server or some other relational database - the relevant SAS Access product needs to be licensed.

If you are using Enterprise Guide to access a remote SAS server you must be able to 'see' your input data from the server (using a URL) or have the data on your PC

Please be much more specific about your requirements.

Richard temporarily back in Oz

Ask a Question
Discussion stats
  • 2 replies
  • 168 views
  • 0 likes
  • 3 in conversation