SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

Define SAS variable as Integer

Accepted Solution Solved
Reply
Super Contributor
Posts: 340
Accepted Solution

Define SAS variable as Integer

Hello,

I must upload data to a SQL server and created the table which contains the column definition and which is to be updated like this:

Libname stage ODBC Schema=ODBC DSN=sqlstage;

Proc SQL;

  Create Table stage.Blend_xx  (Scenario Char (4), Date Date, Alternative Integer, etc.);

Quit;

Am I right that it is no use to define Alternative's length in SAS and that I simply leave the integer-conversion to the access-interface?

Thanks&kind regards


Accepted Solutions
Solution
‎01-12-2015 08:40 AM
Super User
Posts: 5,433

Re: Define SAS variable as Integer

Posted in reply to user24feb

No, I think you need to specify the data type for integers at least, I think the default data type for SAS numrical columns is NUMERIC.

Data Types for ODBC :: SAS/ACCESS(R) 9.4 for Relational Databases: Reference, Sixth Edition

Use the DBTYPE= ds option do override the default conversion.

Or create your table using explicit SQL pass-thru.

Data never sleeps

View solution in original post


All Replies
Solution
‎01-12-2015 08:40 AM
Super User
Posts: 5,433

Re: Define SAS variable as Integer

Posted in reply to user24feb

No, I think you need to specify the data type for integers at least, I think the default data type for SAS numrical columns is NUMERIC.

Data Types for ODBC :: SAS/ACCESS(R) 9.4 for Relational Databases: Reference, Sixth Edition

Use the DBTYPE= ds option do override the default conversion.

Or create your table using explicit SQL pass-thru.

Data never sleeps
Super Contributor
Posts: 340

Re: Define SAS variable as Integer

Works. Thanks!! (Would unmark your answer as helful and set it to right answer, but the homepage for some reasen doesn't let me. sorry.)

Sample program:

Data A;

  Input Name $4. Number @@;
  Datalines;
AAAA 1 BBBB 3 CCCC 7 DDDD 9 EEEE 6
;
Proc SQL;
  Create Table stage.Int_Test (DBType=(Number=Integer)) ( Name Char(4), Number Integer ) ; * this is to define the data types;

  Insert Into stage.Int_Test Select Name, Number As SQL_Integer From A; * this is the actual update;

  Connect to ODBC (DSN=sqlstage); * this is to check which data types are actually assigned;
    Create Table Int_Test_Info As Select * From Connection to ODBC (ODBC:Smiley FrustratedQLColumns (, , "INT_TEST" ));
  Disconnect From ODBC;
Quit;

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 729 views
  • 1 like
  • 2 in conversation