If you have a data set that contains 100 variables, but you
need only five of those, what is the code to force SAS to
use only those variable?
Answers were Sorted based on User's Feedback
Answer / vsrao
keep option
data ddd;
set sss(keep=a b c d e);
run;
| Is This Answer Correct ? | 9 Yes | 0 No |
Answer / ram pabba
It is true to use KEEP option on a dataset to only select
few variables from 100 variables.
We can use KEEP option either on set statement or data
step statement. If we use on SET statement then only the
five variables are created on pdv and only these variables
are sent to the output dataset. If we use KEEP option on
data step statement then all the variables are copied into
pdv and after any maniuplation only the selected variables
on data step statement are processed and sent to output
dataset.
data abc;
set xyz (keep= ab cd ef gh);
run;
data abc(keep= ab cd ef gh ij);
set xyz;
ij=ab+jk;
run;
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / guest
My guess is also the keep statement to keep only 5
variables out of 100 variables..
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / purnimaprasad
Use keep statement to keep only 5 variables out of 100
variables
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / kishore kumar
If ur reading data from any dataset we will use keep option
like set data1(keep = 5 variables);,If ur using in any
procedure just with var statement.If u want to display to
have output with only 5variables out of 100 just use keep
option with data statement.
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / soniya
in data set - use keep
in proc step- use var ,id statements
ex-
data a;
infile urfilename;
input score1-score100;
keep sore1-score5;
run;
input a;
input score1-scor100
run;
proc print data=a;
var score1-score5;
id score1-score5;
run;
observe id-in this statement nuber of obs not displed in
out put
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / sudheer
var is the statement which will be used to get the variable
which are required in the output window, they are also
other answer for it when u r using proc guidelines.
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / chiranjeevi
My guess is using data set option i.e keep
it is used for it decides the no. of variable should remain
with in the dataset
keep<variable list>
2)var statement
it is a keyword or statement used to specify the analysis
variables.The analysis variables are those,which is required
to be restructured.
| Is This Answer Correct ? | 0 Yes | 0 No |
name the scheduler for scheduling job and explain the scheduler? : Sas-di
How to test the debugging in sas?
what are the sites did u refer for enquiries and doubts for SAS
which date function advances a date, time or datetime value by a given interval? : Sas programming
what is the main difference between rename and label? (don't say that they both perform the same function).
how can u create zero observation dataset?
define table lookup and how may ways it can be done...explian
In this question, I rename the numeric variable phone to numphone and then try use phone=put(numphone,comma16.) to store the numeric value numphone as a string value in phone. But I get a warning tha numphone already exists and in the data sat phone doesnt exist and numphone is set to missing. Why? data names_and_more; input Name $20. Phone : comma16. Height & $10. Mixed & $8.; Name = tranwrd(Name,' ',' '); rename phone = numphone; phone = put(numphone,comma16.); datalines; Roger Cody 9,087,821,234 5ft. 10in. 50 1/8 Thomas Jefferson 3,158,488,484 6ft. 1in. 23 1/2 Marco Polo 8,001,234,567 5Ft. 6in. 40 Brian Watson 5,183,551,766 5ft. 10in 89 3/4 Michael DeMarco 4,452,322,233 6ft. 76 1/3 ;
How would you create multiple observations from a single observation?
Hi, I have one dataset like id date ex: id date 1 13 1 13Oct2011 2 14 2 14Oct2011 3 15 3 15Oct2011 --->this is the current date here i want date format like 13Oct2011,14Oct2011 how we can modify the numeric to date format plz answer.
WHAT DOES A SAS SPECIFICATION DOCUMENT SDS CONTAIN ?
what is the difference between proc report and proc format?