數學之路-sas備忘(14),之路-sas備忘14

來源:互聯網
上載者:User

數學之路-sas備忘(14),之路-sas備忘14

sas日期格式


data _null_;

     x='7jan2012'd;
     put x yymm7.;
     put x yymmc7.;
     put x yymmd7.;
     put x yymmn6.;
     put x yymmp7.;
     put x yymms7.;
     put x yymon7.;
put x mmddyy10.;
put x yymmdd10.;

run;


本部落格所有內容是原創,如果轉載請註明來源http://blog.csdn.net/myhaspl/2012M01
2012:01
2012-01
201201
2012.01
2012/01
2012JAN
01/07/2012
2012-01-07
SAS中用數值來表示日期,SAS日期值等於具體日期離1960/1/1天數。

比如:


 date            SAS value   


1959-1-1      -365


1960-1-1         0


1961-1-1         365


2008-1-1       17532

日期輸入與輸出格式
data x12;
input date1:yymmdd10. date2:yymmdd10.;
format date1:yymmdd10. date2:yymmdd10.;
days1=datdif(date1,date2,'act/act');/*按實際*/
days2=datdif(date1,date2,'30/60');/*每個月30天*/
datalines;
2015-01-01 2015-02-14
2014-05-25 2014-06-21
;


proc print ;

run;




data x110;
input date1:anydtdte. date2:anydtdte.;
format date1:yymmdd10. date2:yymmdd10.;
days1=datdif(date1,date2,'act/act');/*按實際*/
days2=datdif(date1,date2,'30/60');/*每個月30天*/
datalines;
2015-01-01 2015-02-14
2014-05-25 2014-06-21
;


proc print ;
title "anydtdte";
run;
Labels and Formats Window

Use the Labels and Formats window to specify labels, widths, and formats for displaying variables in the application. The window contains the following items:

Variable

lists the variables for which you can customize labels and formats. This includes analysis and drill variables. You can add or delete variables by going to the corresponding variable selection windows.

Type

lists the data type for the corresponding variable, as specified in the data set.

N

stands for numeric.

C

stands for character.

Default

type any character other than blank into the field. That value is converted to X. When the Default flag is set, values for labels and formats are read from the repository at run time. If the flag is not set, values specified here are used.

Label

enter a label up to 30 characters long for each variable. Default labels are taken from the repository.

If the Default flag is set, the labels are taken directly from the repository at run time.

Format

enter a format for displaying the variable's values in the report. The format type must match the variable type as shown in the Variable column. The field is initialized with the format from the repository.

You can enter a question mark (?) as the first character in the field to display a list of valid formats.

If the Default flag is set, the formats are taken directly from the repository at run time.

Width

specifies a column width for displaying values of the corresponding variable in the report.

The default width is determined by analyzing the current format. If that is not possible (for example, for user-written character formats), the length of the variable is used. Field width must not be smaller than the width of the formatted values, but it can be larger, for example, to create room for long labels.

Reset

returns all values to the default values specified in the repository.


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.