BookmarkSubscribeRSS Feed
ren2010
Obsidian | Level 7
Hi,

I am creating a table and populate a datetime field with null value,how can i do this.
i tried using put,but gives me lots of error.

any suggestions....

Ren
7 REPLIES 7
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Share what SAS code you have tried (unsuccessfully) for a proper response from others on this forum.

Scott Barry
SBBWorks, Inc.
ren2010
Obsidian | Level 7
proc sql;
create table test1 as
select id ,put(.,datetime19.) into dttime;
quit;

The value in dttime in normal case ,for eg:01DEC2005:00:00:00
but i want null value in there instead of 01DEC2005:00:00:00
DanielSantos
Barite | Level 11
No NULLS ins SAS!

Although some defend that NULLS and MISSING are conceptually the same, they do represent two different things.

From my understanding:

NULL value should mean, NO VALUE FOR
MISSING value should mean, NO KNOWN VALUE FOR

First assumes that some particular information has no value for some attribute, the second assumes that there is no information. Clearly two different things for data analysis and statistics.

Another difference is that a MISSING value represents actually a numeric value, it evaluates to - infinite. NULLS are just NULLS and can only be compared as a match to another NULL value or not.

Anyway, SAS will translate MISSINGS to NULLS when loading data to a RDBMS.

Being a datetime a numeric value, just use the missing notation (represented by . ) like this:
[pre]
select . as DT format=datetime30.6 ...
[/pre]
Cheers from Portugal.

Daniel Santos @ www.cgd.pt
ren2010
Obsidian | Level 7
I have a create a new sas dataset with null value for datetime field
so when using Sql,can i use put(.)?

Please help
ren2010
Obsidian | Level 7
I got the following error;

proc sql;
2518 create table test1 as
2519 select id ,. as te format=datetime19.;
-
22
76
ERROR 22-322: Syntax error, expecting one of the following: a quoted string, ',', AS, FORMAT, FROM, INFORMAT, INTO, LABEL, LEN, LENGTH,
TRANSCODE.

ERROR 76-322: Syntax error, statement will be ignored.
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Here is a place to start - PROC SQL documentation.

Scott Barry
SBBWorks, Inc.

Recommended Google advanced search argument for this topic/post:

proc sql assign missing value site:sas.com


SAS SQL Procedure User's Guide
http://support.sas.com/documentation/cdl/en/sqlproc/62086/HTML/default/a001340013.htm
Flip
Fluorite | Level 6
I execute that code and get no errors. Check spellings arouond that point in your code.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 1106 views
  • 0 likes
  • 4 in conversation