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

How to import multiple xls files into sas. Out of those files, how to get different values from a single variable and how to find number of rows per value type? We can do this using group by for one xls file with proc sql. Was wondering how I can achieve this for multiple files at the same time. Any ideas?

0 Answers  


what are _numeric_ and _character_ and what do they do? : Sas programming

0 Answers  


What is the difference between nodup and nodupkey options?

20 Answers   iFlex, Makro, Talwar,


What is SAS? is it a software just for use or we can creat something over there?

5 Answers   Cognizant,


What are the rows present in protocol Violation table?

2 Answers   Accenture, Quintiles,






Did you used proc lifetest? when?

2 Answers   Accenture, Parexel, Quintiles,


Hello Friends, am new to this forum and am not good at sas progarmming. please can any one of you send me couple of sample large sample SAS Jobs which can you use 200 MB of data and other sas job upto 25GB of data. am doing a performance testing on our legacy systems and new upgraded system. I would really appreciate if you can do me this favor Thank you Priya

0 Answers  


WHAT IS LAG FUNCTION ? WHERE CAN YOU IMPLEMENT THIS FUNCTION?

3 Answers   IBM, Zensar,


what is sas business intelligence? : Sas-bi

0 Answers  


Have you ever linked SAS code? If so, describe the link and any required statements used to either process the code or the step itself.

2 Answers   Accenture,


Have you used macros? For what purpose you have used? : sas-macro

0 Answers  


What are symget and symput? : sas-macro

0 Answers  


Categories