<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic insert values in proc sql in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/insert-values-in-proc-sql/m-p/596038#M76179</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table employeesdata
(employee_id         num (3),
first_name           char(15) ,
last_name            char(18), 	
email                char(18) ,
phone_number         num(18)    ,
hire_date            date	,	
job_id               num(9)   ,  		
salary               num(15)  , 	
commission_pct       num(8)	,	
manager_id     	     num(8),	
department_id        num(8));

insert into employeesdata values(100 ,'steven', 'king' ,'sking' ,515.123.4567 ,17-06-2003,	'adpres'	,24000, 0, 0 ,90);

quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;WARNING: The quoted string currently being processed has become more than 262 characters&lt;BR /&gt;long. You might have unbalanced quotation marks.&lt;BR /&gt;769 last_name char(18),&lt;BR /&gt;770 email char(18) ,&lt;BR /&gt;771 phone_number num(18) ,&lt;BR /&gt;772 hire_date date ,&lt;BR /&gt;773 job_id num(9) ,&lt;BR /&gt;774 salary num(15) ,&lt;BR /&gt;762 insert into employeesdata values(100 ,'steven', 'king' ,'sking' ,'515.123.4567'&lt;BR /&gt;762! ,17-06-2003, 'adpres' ,24000, 0, 0 ,90);&lt;BR /&gt;--------------------&lt;BR /&gt;49&lt;BR /&gt;NOTE 49-169: The meaning of an identifier after a quoted string might change in a future&lt;BR /&gt;SAS release. Inserting white space between a quoted string and the&lt;BR /&gt;succeeding identifier is recommended.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 13 Oct 2019 06:38:50 GMT</pubDate>
    <dc:creator>BrahmanandaRao</dc:creator>
    <dc:date>2019-10-13T06:38:50Z</dc:date>
    <item>
      <title>insert values in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/insert-values-in-proc-sql/m-p/596038#M76179</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table employeesdata
(employee_id         num (3),
first_name           char(15) ,
last_name            char(18), 	
email                char(18) ,
phone_number         num(18)    ,
hire_date            date	,	
job_id               num(9)   ,  		
salary               num(15)  , 	
commission_pct       num(8)	,	
manager_id     	     num(8),	
department_id        num(8));

insert into employeesdata values(100 ,'steven', 'king' ,'sking' ,515.123.4567 ,17-06-2003,	'adpres'	,24000, 0, 0 ,90);

quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;WARNING: The quoted string currently being processed has become more than 262 characters&lt;BR /&gt;long. You might have unbalanced quotation marks.&lt;BR /&gt;769 last_name char(18),&lt;BR /&gt;770 email char(18) ,&lt;BR /&gt;771 phone_number num(18) ,&lt;BR /&gt;772 hire_date date ,&lt;BR /&gt;773 job_id num(9) ,&lt;BR /&gt;774 salary num(15) ,&lt;BR /&gt;762 insert into employeesdata values(100 ,'steven', 'king' ,'sking' ,'515.123.4567'&lt;BR /&gt;762! ,17-06-2003, 'adpres' ,24000, 0, 0 ,90);&lt;BR /&gt;--------------------&lt;BR /&gt;49&lt;BR /&gt;NOTE 49-169: The meaning of an identifier after a quoted string might change in a future&lt;BR /&gt;SAS release. Inserting white space between a quoted string and the&lt;BR /&gt;succeeding identifier is recommended.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 13 Oct 2019 06:38:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/insert-values-in-proc-sql/m-p/596038#M76179</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2019-10-13T06:38:50Z</dc:date>
    </item>
    <item>
      <title>Re: insert values in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/insert-values-in-proc-sql/m-p/596041#M76180</link>
      <description>&lt;P&gt;You most probably had unbalanced quotes further up in the code. Restart the SAS session to clean that up.&lt;/P&gt;</description>
      <pubDate>Sun, 13 Oct 2019 07:10:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/insert-values-in-proc-sql/m-p/596041#M76180</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-10-13T07:10:05Z</dc:date>
    </item>
    <item>
      <title>Re: insert values in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/insert-values-in-proc-sql/m-p/596042#M76181</link>
      <description>&lt;P&gt;Hi sir&amp;nbsp;&lt;/P&gt;&lt;P&gt;i restart the session and run again but still i got&amp;nbsp; error like below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: Table WORK.EMPLOYEESDATA created, with 0 rows and 11 columns.&lt;BR /&gt;14&lt;BR /&gt;15 insert into employeesdata values(100 ,'steven', 'king' ,'sking' ,515.123.4567&lt;BR /&gt;15 ! ,17-06-2003, 'adpres' ,24000, 0, 0 ,90);&lt;BR /&gt;ERROR: VALUES clause 1 attempts to insert more columns than specified after the INSERT&lt;BR /&gt;table name.&lt;BR /&gt;E&lt;/P&gt;&lt;P&gt;NOTE: Table WORK.EMPLOYEESDATA created, with 0 rows and 11 columns.&lt;BR /&gt;14&lt;BR /&gt;15 insert into employeesdata values(100 ,'steven', 'king' ,'sking' ,515.123.4567&lt;BR /&gt;15 ! ,17-06-2003, 'adpres' ,24000, 0, 0 ,90);&lt;BR /&gt;ERROR: VALUES clause 1 attempts to insert more columns than specified after the INSERT&lt;BR /&gt;table name.&lt;BR /&gt;ERROR: Value 10 of VALUES clause 1 does not match the data type of the corresponding&lt;BR /&gt;column in the object-item list (in the SELECT clause).&lt;BR /&gt;16&lt;BR /&gt;17 quit;&lt;BR /&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;real time 3.59 seconds&lt;BR /&gt;cpu time 0.09 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;RROR: Value 10 of VALUES clause 1 does not match the data type of the corresponding&lt;BR /&gt;column in the object-item list (in the SELECT clause).&lt;BR /&gt;16&lt;BR /&gt;17 quit;&lt;BR /&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;real time 3.59 seconds&lt;BR /&gt;cpu time 0.09 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 13 Oct 2019 07:27:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/insert-values-in-proc-sql/m-p/596042#M76181</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2019-10-13T07:27:09Z</dc:date>
    </item>
    <item>
      <title>Re: insert values in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/insert-values-in-proc-sql/m-p/596043#M76182</link>
      <description>&lt;PRE&gt;515.123.4567&lt;/PRE&gt;
&lt;P&gt;is not a valid number. Numbers can only have one decimal period.&lt;/P&gt;
&lt;P&gt;Since, from your previous post, this column is a phone number, I strongly suggest to store it as character.&lt;/P&gt;
&lt;PRE&gt;17-06-2003&lt;/PRE&gt;
&lt;P&gt;is not a valid SAS date value. To supply that date literal correctly, use&lt;/P&gt;
&lt;PRE&gt;'17jun2003'd&lt;/PRE&gt;</description>
      <pubDate>Sun, 13 Oct 2019 08:32:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/insert-values-in-proc-sql/m-p/596043#M76182</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-10-13T08:32:04Z</dc:date>
    </item>
    <item>
      <title>Re: insert values in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/insert-values-in-proc-sql/m-p/596044#M76183</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/265860"&gt;@BrahmanandaRao&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That's because the values you're trying to insert are invalid for the data types in your source table&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is what you're using&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;  insert into employeesdata values(100 ,'steven', 'king' ,'sking' ,515.123.4567 ,'17-06-2003',  'adpres'  ,24000, 0, 0 ,90);
&lt;/PRE&gt;
&lt;P&gt;The values which are invalid:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;515.123.4567&amp;nbsp; - This must be a string which SAS can interpret as a numerical value. The dot is the decimal separator and you can only have one of these.I assume you're using the dot as thousand separator. If so then the value you need to pass is:&amp;nbsp;5151234567&lt;/P&gt;
&lt;P&gt;17-06-2003 - You need to use a SAS date value. One way to go: '17JUN2003'd&lt;/P&gt;
&lt;P&gt;'adpres' - You defined column&amp;nbsp;&lt;EM&gt;job_id&lt;/EM&gt;&amp;nbsp;as&amp;nbsp;num(9) so you can't use a string here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not throwing an error but still to be considered.&lt;/P&gt;
&lt;P&gt;- Unlike for most databases length for a numerical SAS data type doesn't mean the number of digits stored but how much bytes SAS uses to store a number. You would define this with a LENGTH statement. Providing a definition via NUM(n) appears to be simply ignored when creating a SAS table and a variable with length of 8 bytes gets created (which is actually a good thing).&lt;/P&gt;
&lt;P&gt;For DATE variables: You probably want to define a format so that the SAS date values become human readable for printing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Amending the code you've posted below will work.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  create table employeesdata
    (employee_id         num,
    first_name           char(15) ,
    last_name            char(18),  
    email                char(18) ,
    phone_number         num(18)    ,
    hire_date            date format=date9., 
    job_id               num   ,     
    salary               num  ,   
    commission_pct       num , 
    manager_id           num,  
    department_id        num
    )
    ;
  insert into employeesdata values(100 ,'steven', 'king' ,'sking' ,515.123 ,'17jun2003'd,  123  ,24000, 0, 0 ,90);
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 13 Oct 2019 08:37:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/insert-values-in-proc-sql/m-p/596044#M76183</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-10-13T08:37:02Z</dc:date>
    </item>
    <item>
      <title>Re: insert values in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/insert-values-in-proc-sql/m-p/596045#M76184</link>
      <description>&lt;P&gt;And if your goal is to create a dataset from literals, the data step is the way to go:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data employeesdata;
input
  employee_id :$3.
  first_name :$15.
  last_name :$18.
  email :$18.
  phone_number :$18.
  hire_date :ddmmyy10.	
  job_id :$9.  		
  salary	
  commission_pct
  manager_id :$8.
  department_id :$8.
;
format hire_date ddmmyyd10.;
datalines;
100 steven king sking 515.123.4567 17-06-2003 adpres 24000 0 0 90
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It is much easier to add additional datalines than insert statements in SQL.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;Edit: changed the last two&amp;nbsp;&lt;/FONT&gt;&lt;/EM&gt;&lt;FONT size="1"&gt;&lt;I&gt;columns to character, as they obviously contain ID values. Set the correct length as per data specifications.&lt;/I&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 13 Oct 2019 10:00:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/insert-values-in-proc-sql/m-p/596045#M76184</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-10-13T10:00:39Z</dc:date>
    </item>
    <item>
      <title>Re: insert values in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/insert-values-in-proc-sql/m-p/596056#M76185</link>
      <description>&lt;P&gt;sir&amp;nbsp;&lt;/P&gt;&lt;P&gt;suppose i want decimals in&amp;nbsp;&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;commission_pct(0.00)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;insert into employeesdata values(&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token datalines"&gt;&lt;SPAN class="token data string"&gt;100 steven king sking 515.123.4567 17-06-2003 adpres 24000 0.00 0 90&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;commission_pct&amp;nbsp; num(3 , 6)not working&amp;nbsp;&lt;/P&gt;&lt;P&gt;how to solve it&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 13 Oct 2019 10:12:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/insert-values-in-proc-sql/m-p/596056#M76185</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2019-10-13T10:12:35Z</dc:date>
    </item>
    <item>
      <title>Re: insert values in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/insert-values-in-proc-sql/m-p/596057#M76186</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/265860"&gt;@BrahmanandaRao&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The one thing is how SAS stores values internally. For this you just need to pass in a valid string (and 0.00 is valid), the other thing is how SAS prints the values if you don't define an explicit format. If you want anything else than the SAS default for numerical variables (which I believe is BEST32.) then define the format explicitly for the variable when creating the table. This makes the format an attribute of the column and SAS will use it whenever you "look" at the data without defining another format explicitly.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  create table employeesdata
    (employee_id         num,
    first_name           char(15) ,
    last_name            char(18),  
    email                char(18) ,
    phone_number         num(18)    ,
    hire_date            date format=date9., 
    job_id               num   ,     
    salary               num  ,   
    commission_pct       num format=16.2, 
    manager_id           num,  
    department_id        num
    )
    ;
  insert into employeesdata values(100 ,'steven', 'king' ,'sking' ,515.123 ,'17jun2003'd,  123  ,24000, 0.05, 0 ,90);
  insert into employeesdata values(100 ,'steven', 'king' ,'sking' ,515.123 ,'17jun2003'd,  123  ,24000, 0, 0 ,90);
quit;
proc print data=employeesdata;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 13 Oct 2019 10:26:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/insert-values-in-proc-sql/m-p/596057#M76186</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-10-13T10:26:45Z</dc:date>
    </item>
    <item>
      <title>Re: insert values in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/insert-values-in-proc-sql/m-p/596072#M76188</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/265860"&gt;@BrahmanandaRao&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;sir&amp;nbsp;&lt;/P&gt;
&lt;P&gt;suppose i want decimals in&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;commission_pct(0.00)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;insert into employeesdata values(&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token datalines"&gt;&lt;SPAN class="token data string"&gt;100 steven king sking 515.123.4567 17-06-2003 adpres 24000 0.00 0 90&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;commission_pct&amp;nbsp; num(3 , 6)not working&amp;nbsp;&lt;/P&gt;
&lt;P&gt;how to solve it&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It is not at all clear what you are asking.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Remember that SAS stores only two types of variables, fixed length character strings and floating point numbers. You can use any valid number representation in the VALUES() list, the same as you would use in any SAS expression.&amp;nbsp; Character values must be enclosed in quotes.&amp;nbsp; SAS stores dates as numbers, so to insert a date either enter the actual number of days SAS uses for that date, or use a date literal which is a quoted string in a style that the DATE informat can read with the letter D appended after the closing quote, like '17jun2003'd.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want the change how the values are DISPLAYed then attach a FORMAT to the variable. So use a date type format for your date values. You could use the 4.2 format to display percentages with two decimal places.&lt;/P&gt;</description>
      <pubDate>Sun, 13 Oct 2019 15:19:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/insert-values-in-proc-sql/m-p/596072#M76188</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-10-13T15:19:23Z</dc:date>
    </item>
  </channel>
</rss>

