ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   SiteMap shows list of All Categories in this site.
Google
 
Categories  >>  Software  >>  Data Warehouse  >>  SAS
 
 


 

 
 Teradata interview questions  Teradata Interview Questions
 Business Objects interview questions  Business Objects Interview Questions
 Cognos interview questions  Cognos Interview Questions
 Informatica interview questions  Informatica Interview Questions
 Crystal Enterprise Suite interview questions  Crystal Enterprise Suite Interview Questions
 Actuate interview questions  Actuate Interview Questions
 Ab Initio interview questions  Ab Initio Interview Questions
 Data Stage interview questions  Data Stage Interview Questions
 SAS interview questions  SAS Interview Questions
 Micro Strategy interview questions  Micro Strategy Interview Questions
 ETL interview questions  ETL Interview Questions
 Data Warehouse General interview questions  Data Warehouse General Interview Questions
Question
How to convert a given date value into SAS date
 Question Submitted By :: Sk
I also faced this Question!!     Rank Answer Posted By  
 
  Re: How to convert a given date value into SAS date
Answer
# 1
Actually sas stores dates as numbers

eg:: given date  12-07-2009


in sas :: we can store like this `12-07-2009`d
 
Is This Answer Correct ?    3 Yes 5 No
Suresh Ganapuram
 
  Re: How to convert a given date value into SAS date
Answer
# 2
we can store date values using date format 
(ex:date9.,ddmmyyyy10.)
 
Is This Answer Correct ?    11 Yes 0 No
Ranjith
 
 
 
  Re: How to convert a given date value into SAS date
Answer
# 3
We can read the date value with the help of date informats.
Say we have the date 09/13/2008.
Now if we want SAS to read this date, we will use the date 
informat in the input statement like
"input date mmddyy10."
SAS will store this date in the numerical form as the 
number of days passed from 1st january, 1960.
 
Is This Answer Correct ?    4 Yes 0 No
Vipin Choudhary
 
  Re: How to convert a given date value into SAS date
Answer
# 4
If you don't know in advance how the date will be 
formatted, you can use the ANYDTDTE. informat. This will 
extract a SAS date from most date/date-time formats. 
(Warning: ANYDTDTE doesn't fully support day-month-year 
ordering, even if you have this set as your system 
preference, but it still copes with most DMY-formatted 
dates.)
 
Is This Answer Correct ?    0 Yes 0 No
Geoffrey Brent
 
  Re: How to convert a given date value into SAS date
Answer
# 5
e.g the date is '05/09/2007'

we can use the input function to convert this string into SAS date i.e.
date='05/09/2007'
sasdate=input(date,mmddyy10.);

Also, we can use mdy function.For this first use substr function.

m=substr(date,4,2);
d=substr(date,1,2);
y=substr(date,7,4);
sasdate=mdy(m,d,y);
 
Is This Answer Correct ?    2 Yes 0 No
Arish Kumar
 
  Re: How to convert a given date value into SAS date
Answer
# 6
For example if we have a date="14/12/2008".

you have to input it first and the format it like
date1=input(date,ddmmyy10.);
format date1 ddmmyy10.;
run;
 
Is This Answer Correct ?    1 Yes 0 No
Komal
 
  Re: How to convert a given date value into SAS date
Answer
# 7
data temp;
date='17/12/2009';
m=substr(date,4,2);
d=substr(date,1,2);
y=substr(date,7,4);
d1=mdy(m,d,y);
format d1 mmddyy10.;
run;
 
Is This Answer Correct ?    1 Yes 0 No
Sheetal
 

 
 
 
Other SAS Interview Questions
 
  Question Asked @ Answers
 
If you?re not wanting any SAS output from a data step, how would you code the data statement to prevent SAS from producing a set?  1
Code the MEANS to produce output to be used later.  1
Name statements that are recognized at compile time only? Accenture3
Why is a STOP statement needed for the point=option on a SET statement?  2
libname deepak 'C:\SAS Files'; proc format; invalue convert 'A+' = 100 'A' = 96 'A-' = 92 'B+' = 88 'B' = 84 'B-' = 80 'C+' = 76 'C' = 72 'F' = 65; data deepak.grades; input ID $3. Grade convert.; *format Grade convert. ; datalines; 001 A- 002 B+ 003 F 004 C+ 005 A ; proc print data = deepak.grades; run; I get the following output Obs ID Grade 1 001 . 2 002 . 3 003 . 4 004 . 5 005 . I don’t understand why Grade shows up as a missing value. Everything seems fine, including ID $3. Now, in case I use ID : $3. Or use column input, I get the desired output. Kindly help Deepak  4
Are you familiar with special input delimiters? How are they used? Accenture3
What would the following datastep do? Data _null_; Set Dist end=eof; Call Symput("xx"!!left(put(_n_,2.)),&dimension); If EOF then Call Symput('numrows',left(put(_n_,2.))); Run; dimension is a macro variable that is being passed here  1
What is the one statement to set the criteria of data that can be coded in any step?  3
How would you delete observations with duplicate keys? Accenture11
There is a field containing a date. It needs to be displayed in the format “ddmonyy” if it’s before 1975,”dd mon ccyy” if it’s after 1985, and as ‘disco years’ if its between 1975 and 1985. How would you accomplish this in data step code? Using only PROC FORMAT. CTS3
If reading an external file to produce an external file, what is the shortcut to write that record without coding every single variable on the record? Accenture3
Can you excute a macro within a macro? Describe. Genta2
1.What is the difference between _NULL_ , _ALL_, and _N_? 2.What are the uses of _NULL_ using in Data Steps? Can we _NULL_ in Proc Steps also? 3.How do call the macro variable in Data Steps? 4.How to construct Pivot tables in Excel Using SAS?  2
what is the main difference between rename and label? (don't say that they both perform the same function). Parexel9
How would you code a merge that will write the matches of both to one data set, the non-matches from the left-most data set to a second data set, and the non-matches of the right-most data set to a third data set. Accenture9
How would you include common or reuse code to be processed along with your statements? Accenture3
what are the advantages of using SAS in clinical data mangement? why should not we use other software products in managing clinical data? Wockhardt1
How would you delete observations with duplicate keys?  5
What is the difference between an informat and a format? Name three informats or formats. Accenture8
how do u test a pros sql(works or not) without executing it? HSBC1
 
For more SAS Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com