In SAS how to read the variable values having different
formats.
eg:mar99,mar1999 (in a single variable)

Answers were Sorted based on User's Feedback



In SAS how to read the variable values having different formats. eg:mar99,mar1999 (in a single va..

Answer / sankar

data ss;
input name$ s anydtdte9.;
cards;
sankar mar99
mahesh mar1999
run;
proc print data=ss;
format s date9.;
run;

Is This Answer Correct ?    13 Yes 2 No

In SAS how to read the variable values having different formats. eg:mar99,mar1999 (in a single va..

Answer / poornima

To read the data with mar99 and mar1999, we use eurdfmyw.
informat.
This informat is used to read the data with only month and
year.
eg:
data m;
input n date eurdfmy7.;
format date eurdfmy7.;
cards;
12 mar99
45 mar1999
45 sep98
run;
proc print data=m;
run;

Is This Answer Correct ?    10 Yes 3 No

In SAS how to read the variable values having different formats. eg:mar99,mar1999 (in a single va..

Answer / ok

In SAS v9 you can try the ANYDTDTEw. Informat

Is This Answer Correct ?    7 Yes 1 No

In SAS how to read the variable values having different formats. eg:mar99,mar1999 (in a single va..

Answer / chiranjeevi

data code;
input name$ dob monyy7.;
cards;
a mar99
b mar1999
run;
proc print data=code;
format dob monyy7.;
run;

Is This Answer Correct ?    6 Yes 0 No

In SAS how to read the variable values having different formats. eg:mar99,mar1999 (in a single va..

Answer / shaik

data m;
input n date monyy7.;
format date monyy7.;
cards;
12 mar99
45 mar1999
45 sep98
run;

we will get output;

Is This Answer Correct ?    4 Yes 1 No

In SAS how to read the variable values having different formats. eg:mar99,mar1999 (in a single va..

Answer / vijay

for the informats/formats in the question i.e. DATEw.
ones.. we can use the above 2 informats

if the data is in MMDDYYYYw. fashion use EURDFDTw.

Is This Answer Correct ?    3 Yes 2 No

In SAS how to read the variable values having different formats. eg:mar99,mar1999 (in a single va..

Answer / svm

For Date Time check here,

http://www.sfu.ca/sasdoc/sashtml/lrcon/zenid-63.htm

Is This Answer Correct ?    1 Yes 0 No

In SAS how to read the variable values having different formats. eg:mar99,mar1999 (in a single va..

Answer / ravi_kumar

anydtdtew.

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More SAS Interview Questions

Mention what are the data types does SAS contain?

0 Answers  


How do you add a number to a macro variable?

2 Answers  


data study; input Subj : $3. Group : $1. Dose : $4. Weight : $8. Subgroup; x= input(Weight,5.1); datalines; 001 A Low 220 2 002 A High 90 1 003 B Low 193.6 1 004 B High 165 2 005 A Low 123.4 1 ; Why does X get truncated? X shows up as 22 instead of 220,9 instead of 90 and 19.8 instead of 198? This problem doesnt happen with the values 193.6 and 123.4. This does not happen if x is read on the 5. informat instead of the 5.1 informat

2 Answers  


How does Mr.Lanka Srinivas teach SAS? Are his accomplishments real? What are the future prospects for SAS?

1 Answers   Student,


In the flow of DATA step processing, what is the first action in a typical DATA Step?

6 Answers   Accenture,






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

3 Answers  


I use NOCUM/NOPERCENT option in the tables statement like this Proc freq data = deepak; tables x y /nocum nopercent; run; Here I get nopercent and nocum in the output only for variables x and y. How do i do it for all variables? Deepak

1 Answers  


Describe the ways in which you can create macro variables? : sas-macro

0 Answers  


If you need the value of a variable rather than the variable itself what would you use to load the value to a macro variable?

3 Answers  


what is the use of LRECL option.

1 Answers   L&T,


If a variable contains only numbers, can it be a character data type?

0 Answers  


where to use sas business intelligence? : Sas-bi

0 Answers  


Categories