What does “variable = .” (variable = dot) mean in Oracle SQL/SAS?

一曲冷凌霜 提交于 2020-06-08 12:30:08

问题


I am converting a SAS script to Python, where the SAS script was interfacing with an Oracle database, and the Python will be interfacing with a PostgreSQL database. In the SAS code, I found this statement:

proc sql noprint;
create table table_name as
  select distinct wtn
    from another_table
   where account = .
;

What does "where account = ." mean in Oracle? Or is it not an Oracle SQL thing, and instead is a SAS thing? Or is it available in all forms of SQL?

Further, if it is SAS and/or Oracle specific, what would I use in PostgreSQL in its place?


回答1:


In SAS Missing values for numeric variables (including date variables) appear as a period. SAS treats numeric nulls as equal to “the lowest possible number” (essentially negative infinity) when sorting a numeric field.

SAS datasets will have a period as a value for missing data. When you export the data as CSV using proc export, I believe it will create a null value. To really answer your question you will need to know how the ETL from sasdata set to the current database was done.

I expect your data has been normalized for your database. Because of this I think you should use "IS NULL" in place of a "varname = '.' " . See below:

create table table_name as
select distinct wtn
from another_table
  where account is NULL
;

In addition SAS Missing values for character variables appear as blanks. Missing values are set like this for character: if name="none" then name=' '.



来源:https://stackoverflow.com/questions/31078585/what-does-variable-variable-dot-mean-in-oracle-sql-sas

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!