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



If you have a data set that contains 100 variables, but you need only five of those, what is the co..

Answer / vsrao

keep option

data ddd;
set sss(keep=a b c d e);
run;

Is This Answer Correct ?    9 Yes 0 No

If you have a data set that contains 100 variables, but you need only five of those, what is the co..

Answer / guest

My guess is to use Keep statement.

Is This Answer Correct ?    7 Yes 1 No

If you have a data set that contains 100 variables, but you need only five of those, what is the co..

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

If you have a data set that contains 100 variables, but you need only five of those, what is the co..

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

If you have a data set that contains 100 variables, but you need only five of those, what is the co..

Answer / purnimaprasad

Use keep statement to keep only 5 variables out of 100
variables

Is This Answer Correct ?    1 Yes 0 No

If you have a data set that contains 100 variables, but you need only five of those, what is the co..

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

If you have a data set that contains 100 variables, but you need only five of those, what is the co..

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

If you have a data set that contains 100 variables, but you need only five of those, what is the co..

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

If you have a data set that contains 100 variables, but you need only five of those, what is the co..

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

If you have a data set that contains 100 variables, but you need only five of those, what is the co..

Answer / shaik parwez

Using Keep option

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SAS Interview Questions

data data1; input dt account; format dt date9.; cards; 1745 1230 1756 1120 1788 1130 1767 1240 ; data data2; input startdt enddt total; format startdt date9. enddt date9.; cards; 1657 1834 12300 1557 1758 16800 1789 1789 12300 1788 1345 12383 1899 1899 13250 ; proc sql; create table data3 as select * from data1 as x left join data2 as y on x.dt>=y.startdt and x.dt<=y.enddt; quit; Here, we are getting cartision product. But,I want left join report consisting of this program. It should not get duplicate values. you can modify the program also.

0 Answers  


how does sas handle missing values in procs? : Sas programming

0 Answers  


what is SAS/Graph?

1 Answers   CitiGroup, NTPC,


What is the difference between an informat and a format? Name three informats or formats.

13 Answers   Accenture, IBM,


Difference between sum function and using “+” operator?

0 Answers  






what is a method for assigning first.var and last.var to the by groupvariable on unsorted data? : Sas programming

0 Answers  


Are you involved in writing the inferential analysis plan? Tables specfications?

0 Answers  


What is a method for assigning first.VAR and last.VAR to the BY group variable on unsorted data?

0 Answers   Quintiles,


1 new york 7,262,700 2 los angeles 3,259,340 3 philadelphia 1,642,900 how to read the above data using input statement consider the above data is in txt format externally u have to use infile and input statement.

9 Answers   Quintiles,


Code a PROC SORT on a data set containing State, District and County as the primary variables, along with several numeric variables?

3 Answers  


Can we use where and having clauses in a single SAS program. ex: proc sql;     select a,b,c from test      where state in 'KA'      and having <some condition>. Is the above program run correctly, if not why ?     

4 Answers   UHG,


if a variable contain dates like "2015/01"---"2015/12" (yymm) ,How to add day to those dates,if them month is jan then 31 if the month is feb then 28 so on ...

0 Answers   Accenture,


Categories