YYQ ger ett kvartal i formatet 2017Q3. I Sverige tenderar vi skriva 2017K3 istället.
Finns det ett format för det i SAS?
Det findes ikke i SAS så vidt jeg ved
Men du kan lave dit eget PICTURE format i Proc Format
jeg vil tro at dette virker
proc format;
Picture YYK low-high = '%YK%q' datatype=DATE;
run;
Rätt kod skall vara,
proc format library=work;
Picture YYK (default=6) low-high = '%YK%q' (datatype=DATE);
run;
utan default=6 blir resultatet 2017K.
Det skall vara datatype= som du skrev först.
Tack för hjälpen.
Hi,
Super god question.
Another solution is to use the NLDATEYQ8. format. It gives you almost what you want.
This code will give you K4 2017.
data test;
dag = today();
format dag nldateyq8.;
run;
Thanks,
it give 2017 K3 with a space between 7 och K. An interesting alternative.
Du har sikkert hvad du skal bruge nu - hos mig har jeg dog ikke problemer med mellemrum mellem 7 og K
proc format;
picture yyk low - high ='%YK%q' (datatype=DATE) ;
run;
data a;
dag=today();
format dag yyk6.;
put dag yyk5./
dag yyk6./
dag yyk7.;
run;
LOG:
106 proc format;
107 picture yyk low - high ='%YK%q' (datatype=DATE) ;
NOTE: Format YYK is already on the library WORK.FORMATS.
NOTE: Format YYK has been output.
108 run;
NOTE: PROCEDURE FORMAT used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
109
110 data a;
111 dag=today();
112 format dag yyk6.;
113 put dag yyk5./
114 dag yyk6./
115 dag yyk7.;
116 run;
NOTE: Compression was disabled for data set WORK.A because compression overhead
would increase the size of the data set.
2017K
2017K4
2017K4
NOTE: The data set WORK.A has 1 observations and 1 variables.
NOTE: DATA statement used (Total process time):
real time 0.03 seconds
cpu time 0.03 seconds
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!