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.

Answer Posted / j. sheetal

Here is the correction in above example,
proc format;
value datestyl low-'31dec1974'd = [date7.]
'01jan1975'd - '31dec1985'd = 'disco Years'
'01jan1986'd - high = [date9.] ;
Run;

Example:

data k1;
input date2 $9.;
cards;
31dec1974
01jan1975
01jan1985
01jan1990
;

data temp;
set k1;
date1=input(date2,date9.);
sam = date1;
format sam datestyl.;
run;

proc print;
run;

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

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

576


Difference between informat and format?

648


Explain data_null_?

614


what is star schema? : Sas-di

649


what is sas enterprise intelligence architecture? : Sas-bi

548






I have a SCD Type 2 Dimention for Location In which A Sales Office in Having two Surrogate Keys just because of the change in it's Sales Group. SKey SalesGroup Sales Office BeginDate EndDate 280 SG1 SO1 01APR2000 01APR2010 281 SG2 SO1 02APR2010 31MAR2999 Now while loading the Fact, the Lookup ir returning SKey 280 for records before and after 01APR2010. I am not able to give WHERE condition in the Lookup Properties (TranDate between BeginDate and EndDate). Please help.

1704


What are all the problems you faced while validating tables and reports?

3018


What is the role of sas grid administrator? : sas-grid-administration

836


what are the new features included in the new version of sas i.e., Sas 9.1.3? : Sas programming

552


For what purposes have you used sas macros? : sas-macro

540


what is the difference between floor and ceil functions in sas? : Sas-administrator

708


What is the function of output statement in a SAS Program?

619


how to create the AE dataset by using SDTMIG specifications and SAP plan by using UNIX platform?

2299


name several ways to achieve efficiency in your program? : Sas programming

575


What are the implications?

1187