首页 \ 问答 \ SAS日期格式(SAS date formatting)

SAS日期格式(SAS date formatting)

我有一个带变量的数据集,开始日期,它使用字符格式获取许多不同的值。

我使用开始日期列中的值拆分数据集,因为我想将日期变量转换为两个具有两个不同日期值的新列:

if length(Startvalue) = 6 then output  a6;
else if length(Startvalue) = 8 then output a8 ;
else if length(Startvalue) = 1 then output a1;
else output a_other;

一个值写成这样:090209(DDMMYY)

我想将变量格式化为date9。 格式和DDMMYYD10。 格式如下:

FORMAT  Startvalue2 date9.;
format Startvalue3 DDMMYYD10.;

我在数据步骤中使用此方法:

FORMAT  Startdato2 date9.;
format startdato3 DDMMYYD10.;
Startdato2 = INPUT(PUT(Startdato,6.),DDMMYY6.);
Startdato3 = INPUT(PUT(Startdato,6.),DDMMYY6.);

另一个值是这样写的:15-08-17(DD-MM-YY)我也想要这个值的两种格式,如下所示:

FORMAT  Startvalue2 date9.;
format Startvalue3 DDMMYYD10.;

但在这里我不能使用上面的表达副本:

FORMAT  Startvalue2 date9.;
format Startvalue3 DDMMYYD10.;
Startvalue2 = INPUT(PUT(Startvalue,8.),DDMMYYDw.);
Startvalue3= INPUT(PUT(Startvalue,8.),DDMMYYDw.);

你知道为什么吗? 以及如何将价值转化为日期9。 格式和DDMMYYD10格式?

亲切的问候

玛丽亚


I have a dataset with a variable, start date, which takes a lot of different values using a character format.

I have split the dataset up using the values in the start date column, because I want to transform the date variable into two new columns with two different date values:

if length(Startvalue) = 6 then output  a6;
else if length(Startvalue) = 8 then output a8 ;
else if length(Startvalue) = 1 then output a1;
else output a_other;

One value is written like this: 090209 (DDMMYY)

I want to format the variable into both a date9. format and a DDMMYYD10. format like this:

FORMAT  Startvalue2 date9.;
format Startvalue3 DDMMYYD10.;

I got it to work with this approach in a data step:

FORMAT  Startdato2 date9.;
format startdato3 DDMMYYD10.;
Startdato2 = INPUT(PUT(Startdato,6.),DDMMYY6.);
Startdato3 = INPUT(PUT(Startdato,6.),DDMMYY6.);

Another value is written like this: 15-08-17 (DD-MM-YY) I also want the two formats on this value, like this:

FORMAT  Startvalue2 date9.;
format Startvalue3 DDMMYYD10.;

BUT here I cannot use a copy of my expression from above:

FORMAT  Startvalue2 date9.;
format Startvalue3 DDMMYYD10.;
Startvalue2 = INPUT(PUT(Startvalue,8.),DDMMYYDw.);
Startvalue3= INPUT(PUT(Startvalue,8.),DDMMYYDw.);

Do you know why? And how I can get the value transformed into a date9. format and a DDMMYYD10 format?

Kind regards

Maria


原文:https://stackoverflow.com/questions/43279312
更新时间:2023-09-20 12:09

最满意答案

感谢您没有回答我的问题,所以我通过使用图表控件底部的datalist来完成自己的任务。 我在表中添加了一个datalist控件,其中存在图表控件,并将所需的数据表绑定到datalist,并在运行时将数据绑定到datalist控件。 为了显示datalist中的数据,我使用了datalist的RepearDirection属性并将其设置为“Horizo​​ntal”。 最后,我的报告显示为我所需的格式。 对于图表区域,我为相同的X和Y点添加了两种类型的系列,以便按照我的要求显示折线图,一个系列是气泡而另一个是线。

所以,最后我的图表显示如下。

在此处输入图像描述


Thank you for not responding to my question, so any how I have done it my self by using datalist at the bottom of the chart control. I added one datalist control to the table in which chart control is present and binded the required data table to the datalist and also binded images to the datalist control at runtime from a datatable. Inorder to display the data present in datalist, i used RepearDirection property of the datalist and set it to "Horizontal". Finally my report displayed like my required format. And for the chart area, i added two types of series for the same X and Y points inorder to display Line chart as I required, one series is bubble and another is line.

So, finally my graph displayed as below.

enter image description here

相关问答

更多

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)