本文介绍了SAS:以永久数据集中的日期格式从 csv 文件中获取 DD-MMM-YYYY 格式的日期数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从永久数据集中的 csv 文件中导入数据,该数据集中具有此日期列,其数据格式类似于dd-mmm-yyyy",例如22-FEB-1990".我也希望将其作为数据集中的日期格式导入.我尝试了许多格式信息,但在列中没有得到任何信息.

I would like to import data from a csv file in a permanent data set which has this date column with data format like "dd-mmm-yyyy" like "22-FEB-1990". I want this to be imported as date format inside the data set too. I have tried many format informats but i am not getting anything in the column.

这是我写的代码(虽然我注释掉了某些东西,但我已经用我能想到的格式和信息测试了所有排列和组合):

Here is the code i wrote(While I commented out certain things I have tested all the permutations and combinations with the formats and informats i could think of):

    libname asgn1 "C:Users*****abc";
    data asgn1.Car_sales_1_1;
          infile  "C:Users********Car_sales.csv" dsd dlm="," FIRSTOBS=2 ;
          input Manufacturer $ Model $ Fuel_efficiency Latest_Launch;
          * format Latest_Launch mmddyy10.;
          * informat  Latest_Launch mmddyy10.;
    run;

请帮忙...

推荐答案

将您的信息更改为 date11. (dd-mmm-yyyy).

Change your informat to date11. (dd-mmm-yyyy).

按类别划分的 SAS 信息 > http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a001239776.htm

SAS Informats by Category > http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a001239776.htm

这篇关于SAS:以永久数据集中的日期格式从 csv 文件中获取 DD-MMM-YYYY 格式的日期数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 03:14