<?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 Re: Problem with insert into in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-insert-into/m-p/782831#M249566</link>
    <description>&lt;P&gt;Repeating the same action over and over and expecting a different result is a sure sign of insanity (Einstein).&lt;/P&gt;
&lt;P&gt;You&amp;nbsp;&lt;STRONG&gt;CANNOT&lt;/STRONG&gt; insert a string into a numeric variable.&lt;/P&gt;</description>
    <pubDate>Mon, 29 Nov 2021 07:58:01 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2021-11-29T07:58:01Z</dc:date>
    <item>
      <title>Problem with insert into</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-insert-into/m-p/782760#M249545</link>
      <description>&lt;P&gt;I have a problem, I want to extract from the library exchange rates between two dates for EUR and USD, but I have to add PLN = 1 to calculate other values. But when I try to insert into it, it shows me an error&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sql;
	create table kursy as
	select 
			DATA_DANYCH,
			CURRENCY_SHORT_NAME				as WALUTA,
			REVAL_RATEMID					as KURS
	from kondor.K_FXRATES
	where DATA_DANYCH between '24Apr2016'd and &amp;amp;gv_date_kon.
	  and CURRENCY_SHORT_NAME in ("EUR", "USD")
	order by DATA_DANYCH
;

	insert into kursy values('REVAL_RATEMID','PLN', 1)
;
quit;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;
&lt;TABLE border="1" width="99.86737400530504%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="47.61273209549072%"&gt;DATA_DANYCH&lt;/TD&gt;
&lt;TD width="28.381962864721483%"&gt;WALUTA&lt;/TD&gt;
&lt;TD width="23.872679045092838%"&gt;KURS&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="47.61273209549072%"&gt;2021-04-21&lt;/TD&gt;
&lt;TD width="28.381962864721483%"&gt;EUR&lt;/TD&gt;
&lt;TD width="23.872679045092838%"&gt;4,5567&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="47.61273209549072%"&gt;2021-04-21&lt;/TD&gt;
&lt;TD width="28.381962864721483%"&gt;USD&lt;/TD&gt;
&lt;TD width="23.872679045092838%"&gt;4,4222&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="47.61273209549072%"&gt;2021-04-21&lt;/TD&gt;
&lt;TD width="28.381962864721483%"&gt;PLN&lt;/TD&gt;
&lt;TD width="23.872679045092838%"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;Above table is what i expect :&lt;/P&gt;
&lt;P&gt;Error is below:&lt;/P&gt;
&lt;P&gt;50 insert into kursy values('REVAL_RATEMID','PLN', 1)&lt;BR /&gt;2 System SAS 14:38 Sunday, November 28, 2021&lt;/P&gt;
&lt;P&gt;51 ;&lt;BR /&gt;ERROR: Value 1 of VALUES clause 1 does not match the data type of the corresponding column in the object-item list (in the SELECT &lt;BR /&gt;clause).&lt;/P&gt;</description>
      <pubDate>Sun, 28 Nov 2021 15:07:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-insert-into/m-p/782760#M249545</guid>
      <dc:creator>Gieorgie</dc:creator>
      <dc:date>2021-11-28T15:07:37Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with insert into</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-insert-into/m-p/782762#M249546</link>
      <description>&lt;P&gt;Please do not show us error messages separated from the code. Please DO show us the entire log for this PROC SQL, every single line of the log for this PROC SQL, so we can see the code as it appears in the log; so we can see the NOTEs, WARNINGs and ERRORs as they appear in the log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please preserve the formatting of the log by pasting it as text into the window that appears when you click on the &amp;lt;/&amp;gt; icon. &lt;STRONG&gt;DO NOT SKIP THIS STEP&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Insert Log Icon in SAS Communities.png" style="width: 859px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66171iFEC370B1DBF07B28/image-size/large?v=v2&amp;amp;px=999" role="button" title="Insert Log Icon in SAS Communities.png" alt="Insert Log Icon in SAS Communities.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 28 Nov 2021 15:31:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-insert-into/m-p/782762#M249546</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-11-28T15:31:00Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with insert into</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-insert-into/m-p/782763#M249547</link>
      <description>&lt;P&gt;data_danych is a date, and you try to insert the string REVAL_RATEMID in the second INSERT.&lt;/P&gt;</description>
      <pubDate>Sun, 28 Nov 2021 15:41:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-insert-into/m-p/782763#M249547</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-11-28T15:41:58Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with insert into</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-insert-into/m-p/782825#M249564</link>
      <description>but when i tried put like this 	insert into kursy values('DATA_DANYCH',"PLN", 1)&lt;BR /&gt;i got same error</description>
      <pubDate>Mon, 29 Nov 2021 07:09:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-insert-into/m-p/782825#M249564</guid>
      <dc:creator>Gieorgie</dc:creator>
      <dc:date>2021-11-29T07:09:47Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with insert into</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-insert-into/m-p/782828#M249565</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/401093"&gt;@Gieorgie&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;but when i tried put like this insert into kursy values('DATA_DANYCH',"PLN", 1)&lt;BR /&gt;i got same error&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Rephrasing what Kurt already said: your first variable is a date, dates can't be set to a string-value.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Nov 2021 07:47:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-insert-into/m-p/782828#M249565</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-11-29T07:47:25Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with insert into</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-insert-into/m-p/782831#M249566</link>
      <description>&lt;P&gt;Repeating the same action over and over and expecting a different result is a sure sign of insanity (Einstein).&lt;/P&gt;
&lt;P&gt;You&amp;nbsp;&lt;STRONG&gt;CANNOT&lt;/STRONG&gt; insert a string into a numeric variable.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Nov 2021 07:58:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-insert-into/m-p/782831#M249566</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-11-29T07:58:01Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with insert into</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-insert-into/m-p/782832#M249567</link>
      <description>Ok i ubderstand, but is there any chance to put PLN =1 to each date?</description>
      <pubDate>Mon, 29 Nov 2021 08:08:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-insert-into/m-p/782832#M249567</guid>
      <dc:creator>Gieorgie</dc:creator>
      <dc:date>2021-11-29T08:08:20Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with insert into</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-insert-into/m-p/782876#M249578</link>
      <description>&lt;OL&gt;
&lt;LI&gt;Supply usable example data. Usable = a working data step with datalines, posted in a code box. This is&amp;nbsp;&lt;STRONG&gt;essential&lt;/STRONG&gt; to enable us to test our code suggestions and&amp;nbsp;&lt;STRONG&gt;MUST NOT BE SKIPPED&lt;/STRONG&gt;.&lt;/LI&gt;
&lt;LI&gt;Show what you expect to get out of this.&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Mon, 29 Nov 2021 11:34:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-insert-into/m-p/782876#M249578</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-11-29T11:34:12Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with insert into</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-insert-into/m-p/782894#M249583</link>
      <description>im trying do from your data steps instruction %data2datastep(kursy,work,,5) but i got error :WARNING: Apparent invocation of macro DATA2DATASTEP not resolved.&lt;BR /&gt;27         &lt;BR /&gt;28         %data2datastep(kursy,work,,5)&lt;BR /&gt;           _&lt;BR /&gt;           180&lt;BR /&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;BR /&gt;I dont know why</description>
      <pubDate>Mon, 29 Nov 2021 12:29:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-insert-into/m-p/782894#M249583</guid>
      <dc:creator>Gieorgie</dc:creator>
      <dc:date>2021-11-29T12:29:33Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with insert into</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-insert-into/m-p/782896#M249585</link>
      <description>&lt;P&gt;In order to use the macro, you must first run the code that defines it.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Nov 2021 12:33:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-insert-into/m-p/782896#M249585</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-11-29T12:33:49Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with insert into</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-insert-into/m-p/782902#M249589</link>
      <description>&lt;P&gt;Im used download macro and i get like this ;&lt;/P&gt;
&lt;PRE&gt;28         %data2datastep(kursy,work,5)
NOTE: No rows were selected.
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds
      

DATA2DATASTEP DSN &amp;#6;KURSY&amp;#8;
DATA2DATASTEP FILE create_5_&amp;#6;KURSY&amp;#8;_data.sas
DATA2DATASTEP FMT &amp;#6;YES&amp;#8;
DATA2DATASTEP FMTLIST DATA_DANYCH YYMMDD10.
DATA2DATASTEP INPUTLIST DATA_DANYCH:YYMMDD10. WALUTA:$100. KURS:32.
DATA2DATASTEP LBL &amp;#6;YES&amp;#8;
DATA2DATASTEP LIB &amp;#6;WORK&amp;#8;
DATA2DATASTEP MEMLABEL 
DATA2DATASTEP MSGTYPE NOTE
DATA2DATASTEP OBS MAX
DATA2DATASTEP OUTLIB 5
DATA2DATASTEP VARLIST DATA_DANYCH WALUTA KURS&lt;/PRE&gt;
&lt;P&gt;I have like here:&lt;/P&gt;
&lt;TABLE border="1" width="99.87261146496814%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="47.64331210191083%"&gt;DATA_DANYCH&lt;/TD&gt;
&lt;TD width="28.280254777070063%"&gt;WALUTA&lt;/TD&gt;
&lt;TD width="23.949044585987263%"&gt;KURS&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="47.64331210191083%"&gt;2021-04-21&lt;/TD&gt;
&lt;TD width="28.280254777070063%"&gt;EUR&lt;/TD&gt;
&lt;TD width="23.949044585987263%"&gt;4,5567&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="47.64331210191083%"&gt;2021-04-21&lt;/TD&gt;
&lt;TD width="28.280254777070063%"&gt;USD&lt;/TD&gt;
&lt;TD width="23.949044585987263%"&gt;4,4222&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;and I would like to add PLN = 1 to each date&lt;/P&gt;
&lt;TABLE border="1" width="99.87261146496814%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="47.64331210191083%"&gt;DATA_DANYCH&lt;/TD&gt;
&lt;TD width="28.280254777070063%"&gt;WALUTA&lt;/TD&gt;
&lt;TD width="23.949044585987263%"&gt;KURS&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="47.64331210191083%"&gt;2021-04-21&lt;/TD&gt;
&lt;TD width="28.280254777070063%"&gt;EUR&lt;/TD&gt;
&lt;TD width="23.949044585987263%"&gt;4,5567&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="47.64331210191083%"&gt;2021-04-21&lt;/TD&gt;
&lt;TD width="28.280254777070063%"&gt;USD&lt;/TD&gt;
&lt;TD width="23.949044585987263%"&gt;4,4222&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="47.64331210191083%"&gt;2021-04-21&lt;/TD&gt;
&lt;TD width="28.280254777070063%"&gt;PLN&lt;/TD&gt;
&lt;TD width="23.949044585987263%"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Mon, 29 Nov 2021 12:52:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-insert-into/m-p/782902#M249589</guid>
      <dc:creator>Gieorgie</dc:creator>
      <dc:date>2021-11-29T12:52:14Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with insert into</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-insert-into/m-p/782922#M249594</link>
      <description>&lt;P&gt;Drop insert, it won't work in your case, use a data step instead. Untested code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set kursy;
  by data_daynch;
  output;
  if last.data_danych then do;
    waluta = "PLN";
    kurs = 1;
    output;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Nov 2021 14:41:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-insert-into/m-p/782922#M249594</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-11-29T14:41:48Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with insert into</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-insert-into/m-p/783066#M249644</link>
      <description>&lt;P&gt;So you seem to have clarified your request.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;I would like to add PLN = 1 to each date&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;Why not just add them when you create the dataset?&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;create table kursy as

  select DATA_DANYCH
       , CURRENCY_SHORT_NAME as WALUTA
       , REVAL_RATEMID as KURS
  from kondor.K_FXRATES
  where DATA_DANYCH between '24Apr2016'd and &amp;amp;gv_date_kon.
    and CURRENCY_SHORT_NAME in ("EUR", "USD")

  union

  select distinct 
         DATA_DANYCH
       , 'PLN' as WALUTA
       , 1 as KURS
  from kondor.K_FXRATES
  where DATA_DANYCH between '24Apr2016'd and &amp;amp;gv_date_kon.
    and CURRENCY_SHORT_NAME in ("EUR", "USD")

  order by DATA_DANYCH
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;Now if you want to add a record for every date from&amp;nbsp;'24Apr2016'd to &amp;amp;gv_date_kon rather than just those that appear in&amp;nbsp;kondor.K_FXRATES then you might want a different approach.&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data extra ;
  if 0 then set kursy ;
  WALUTA = 'PLN' ;
  KURS=1;
  do DATA_DANYCH =  '24Apr2016'd to  &amp;amp;gv_date_kon. ;
    output;
  end;
run;
proc append base=kursy data=extra;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Nov 2021 05:49:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-insert-into/m-p/783066#M249644</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-11-30T05:49:57Z</dc:date>
    </item>
  </channel>
</rss>

