<?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: Hard coding in proc sql in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Hard-coding-in-proc-sql/m-p/425473#M104818</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;...&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;create table new as&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; select *, Newvar='Some text', SomeNum=3&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; from sashelp.class;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;...&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That won't work.&amp;nbsp; That is still assignment statement syntax instead of SELECT statement syntax.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table new as
  select *, 'Some text' as NewVar, 3 as SomeNum
  from sashelp.class
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 06 Jan 2018 01:23:27 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2018-01-06T01:23:27Z</dc:date>
    <item>
      <title>Hard coding in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hard-coding-in-proc-sql/m-p/425247#M104734</link>
      <description>&lt;P&gt;Appreciate if someone of you help me translate the below code in proc sql.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
CURRENCY_CD ='EUR';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Jan 2018 15:04:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hard-coding-in-proc-sql/m-p/425247#M104734</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2018-01-05T15:04:01Z</dc:date>
    </item>
    <item>
      <title>Re: Hard coding in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hard-coding-in-proc-sql/m-p/425249#M104736</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/8409"&gt;@Babloo&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Appreciate if someone of you help me translate the below code in proc sql.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
CURRENCY_CD ='EUR';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Surely you can take a try at doing this in SQL yourself. If you can't get it, show us your code and we'll be able to help.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jan 2018 15:09:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hard-coding-in-proc-sql/m-p/425249#M104736</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-01-05T15:09:15Z</dc:date>
    </item>
    <item>
      <title>Re: Hard coding in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hard-coding-in-proc-sql/m-p/425255#M104738</link>
      <description>SAS SQL is very close to/based on ANSI SQL. So you can practically take any SQL training and apply it to SAS.&lt;BR /&gt;That said, what so you want to do this at all? There could be some reasons to create a data set with just one  value, but why do you need to be SQL?&lt;BR /&gt;That said, the SELECT statement requires a FROM clause so this kind of operations are easier dealt with using the data step.</description>
      <pubDate>Fri, 05 Jan 2018 15:33:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hard-coding-in-proc-sql/m-p/425255#M104738</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2018-01-05T15:33:10Z</dc:date>
    </item>
    <item>
      <title>Re: Hard coding in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hard-coding-in-proc-sql/m-p/425257#M104739</link>
      <description>&lt;P&gt;While it's easier to do with a datastep, you can do the same thing using proc sql. You can read about it at: &lt;A href="http://support.sas.com/documentation/cdl/en/sqlproc/63043/HTML/default/viewer.htm#n1ncn0pznd8wrln1tnp3xdxjz9xz.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/sqlproc/63043/HTML/default/viewer.htm#n1ncn0pznd8wrln1tnp3xdxjz9xz.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;e.g.:&lt;/P&gt;
&lt;PRE&gt;proc sql;
  create table test
    (CURRENCY_CD char(3))
  ;
  insert into test
    values('EUR')
  ;
quit;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jan 2018 15:37:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hard-coding-in-proc-sql/m-p/425257#M104739</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-01-05T15:37:32Z</dc:date>
    </item>
    <item>
      <title>Re: Hard coding in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hard-coding-in-proc-sql/m-p/425320#M104757</link>
      <description>I'm doing a data manipulation in Proc sql and as part of that I need to&lt;BR /&gt;create the new variable as mentioned in the post.  I'm trying to fit the&lt;BR /&gt;new variable in the Proc sql which I'm working on instead of creating the&lt;BR /&gt;new datastep for one variable.&lt;BR /&gt;</description>
      <pubDate>Fri, 05 Jan 2018 18:39:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hard-coding-in-proc-sql/m-p/425320#M104757</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2018-01-05T18:39:43Z</dc:date>
    </item>
    <item>
      <title>Re: Hard coding in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hard-coding-in-proc-sql/m-p/425338#M104767</link>
      <description>&lt;P&gt;Are you trying to use proc sql to create a file containing just the one new variable with a constant value, or are you trying to add that variable to an existing dataset?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jan 2018 19:14:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hard-coding-in-proc-sql/m-p/425338#M104767</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-01-05T19:14:16Z</dc:date>
    </item>
    <item>
      <title>Re: Hard coding in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hard-coding-in-proc-sql/m-p/425354#M104771</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/8409"&gt;@Babloo&lt;/a&gt; wrote:&lt;BR /&gt;I'm doing a data manipulation in Proc sql and as part of that I need to&lt;BR /&gt;create the new variable as mentioned in the post. I'm trying to fit the&lt;BR /&gt;new variable in the Proc sql which I'm working on instead of creating the&lt;BR /&gt;new datastep for one variable.&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Hint: Show a brief example of what you have and a matching example of what the result should look like.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your initial post did not create a data set or reference a data set so you left out a lot of details about what you might be attempting to do.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This code will create a new data set from an existing one and add&amp;nbsp; new variables with the same value for each record:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;create table new as&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; select *, Newvar='Some text', SomeNum=3&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; from sashelp.class;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this does not match what you are attempting to do then please refer to the HINT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jan 2018 20:06:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hard-coding-in-proc-sql/m-p/425354#M104771</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-01-05T20:06:35Z</dc:date>
    </item>
    <item>
      <title>Re: Hard coding in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hard-coding-in-proc-sql/m-p/425472#M104817</link>
      <description>I'm trying to add that variable to an existing dataset.&lt;BR /&gt;</description>
      <pubDate>Sat, 06 Jan 2018 01:21:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hard-coding-in-proc-sql/m-p/425472#M104817</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2018-01-06T01:21:43Z</dc:date>
    </item>
    <item>
      <title>Re: Hard coding in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hard-coding-in-proc-sql/m-p/425473#M104818</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;...&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;create table new as&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; select *, Newvar='Some text', SomeNum=3&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; from sashelp.class;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;...&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That won't work.&amp;nbsp; That is still assignment statement syntax instead of SELECT statement syntax.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table new as
  select *, 'Some text' as NewVar, 3 as SomeNum
  from sashelp.class
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 06 Jan 2018 01:23:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hard-coding-in-proc-sql/m-p/425473#M104818</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-01-06T01:23:27Z</dc:date>
    </item>
    <item>
      <title>Re: Hard coding in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hard-coding-in-proc-sql/m-p/425476#M104819</link>
      <description>&lt;P&gt;If your dataset is called test you could use:&lt;/P&gt;
&lt;PRE&gt;proc sql;
  alter table test
    add CURRENCY_CD char(3)
  ;
  update test
    set CURRENCY_CD='EUR'
  ;
quit;
&lt;/PRE&gt;
&lt;P&gt;Of course, it could be any other name, just change the two instances where my suggested code uses test.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 06 Jan 2018 01:46:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hard-coding-in-proc-sql/m-p/425476#M104819</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-01-06T01:46:25Z</dc:date>
    </item>
  </channel>
</rss>

