初学者 - SAS中的出生日期

发布于 2025-01-17 15:48:45 字数 1067 浏览 2 评论 0原文

在此处输入图像描述我是初级班的 SAS 编码新手,我正在努力与基础知识。我试图首先创建一个 date_of_birth 变量,但我不断发现month_of_birth、day_of_birth 和year_of_birth 未初始化。我已将代码放在下面,任何帮助将不胜感激!

code:



data dob;
set Assign6_sp2022;
date_of_birth = MDY (Month_of_Birth, Day_of_Birth, Year_of_Birth);
run;

log:
48   data dob;
49   set Assign6_sp2022;
50   date_of_birth = MDY (Month_of_Birth, Day_of_Birth, Year_of_Birth);
51   run;

NOTE: Variable Month_of_Birth is uninitialized.
NOTE: Variable Day_of_Birth is uninitialized.
NOTE: Variable Year_of_Birth is uninitialized.
NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      1 at 50:17
NOTE: There were 1 observations read from the data set WORK.ASSIGN6_SP2022.
NOTE: The data set WORK.DOB has 1 observations and 5 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds

enter image description hereI'm new to SAS coding in a beginning class and I'm struggling with the basics. I'm trying to first create a date_of_birth variable but I keep getting that month_of_birth, day_of_birth, and year_of_birth is uninitialized. I've put the code below, any help would be appreciated!

code:



data dob;
set Assign6_sp2022;
date_of_birth = MDY (Month_of_Birth, Day_of_Birth, Year_of_Birth);
run;

log:
48   data dob;
49   set Assign6_sp2022;
50   date_of_birth = MDY (Month_of_Birth, Day_of_Birth, Year_of_Birth);
51   run;

NOTE: Variable Month_of_Birth is uninitialized.
NOTE: Variable Day_of_Birth is uninitialized.
NOTE: Variable Year_of_Birth is uninitialized.
NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      1 at 50:17
NOTE: There were 1 observations read from the data set WORK.ASSIGN6_SP2022.
NOTE: The data set WORK.DOB has 1 observations and 5 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

初见 2025-01-24 15:48:45

您的表似乎位于 Assn6 库中。
确保在 set 语句中使用它:set Assn6.Assign6_sp2022

另外,您的变量名称中似乎有空格。
如果是这种情况,您需要使用带引号的字符串,后跟字母 N。
请改用“出生月份”n“出生日期”n“出生年份”n

data dob;
set Assn6.Assign6_sp2022;
date_of_birth = mdy("Month of Birth"n, "Day of Birth"n, "Year of Birth"n);
run;

It seems your table is in the Assn6 library.
Make sure to use it in the set statement : set Assn6.Assign6_sp2022.

Also it seems your variables have spaces in their names.
if that is the case, you need to use a quoted string followed by the letter N.
Use "Month of Birth"n, "Day of Birth"n and "Year of Birth"n instead.

data dob;
set Assn6.Assign6_sp2022;
date_of_birth = mdy("Month of Birth"n, "Day of Birth"n, "Year of Birth"n);
run;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文