<?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: Cell info to variable in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/Cell-info-to-variable/m-p/304556#M1320</link>
    <description>&lt;P&gt;The solution was:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;BR /&gt;select * from X&amp;nbsp;as Z;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;data DATA3;&lt;BR /&gt;set DATA2(where=(COL1=&amp;amp;&lt;STRONG&gt;Z&lt;/STRONG&gt;));&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Fri, 14 Oct 2016 07:15:10 GMT</pubDate>
    <dc:creator>mariange8282</dc:creator>
    <dc:date>2016-10-14T07:15:10Z</dc:date>
    <item>
      <title>Cell info to variable</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Cell-info-to-variable/m-p/304550#M1316</link>
      <description>&lt;P&gt;Hi, I have a table X with column Y with just one observacion = 2&lt;/P&gt;&lt;P&gt;Y&amp;nbsp;&lt;/P&gt;&lt;P&gt;2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to have this 2 as a numeric value in a variable.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2016 06:38:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Cell-info-to-variable/m-p/304550#M1316</guid>
      <dc:creator>mariange8282</dc:creator>
      <dc:date>2016-10-14T06:38:31Z</dc:date>
    </item>
    <item>
      <title>Re: Cell info to variable</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Cell-info-to-variable/m-p/304551#M1317</link>
      <description>&lt;P&gt;I guess that Y is of type character.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data x_new;
set x;
y_num = input(y,best.);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;will create the numeric variable y_new and assign it the value from y, if that can reasonably be converted.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2016 06:41:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Cell-info-to-variable/m-p/304551#M1317</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-10-14T06:41:13Z</dc:date>
    </item>
    <item>
      <title>Re: Cell info to variable</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Cell-info-to-variable/m-p/304552#M1318</link>
      <description>&lt;P&gt;I really do not understand&amp;nbsp;your problem fully. It would be nice if you can give more description.&lt;/P&gt;&lt;P&gt;Otherwise try below code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data X;
input Y;
datalines;
2
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 14 Oct 2016 06:42:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Cell-info-to-variable/m-p/304552#M1318</guid>
      <dc:creator>RahulG</dc:creator>
      <dc:date>2016-10-14T06:42:52Z</dc:date>
    </item>
    <item>
      <title>Re: Cell info to variable</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Cell-info-to-variable/m-p/304555#M1319</link>
      <description>&lt;P&gt;I have a table X with just one column and one row. Just one value Z type Numeric.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to know&amp;nbsp;Z because I need to filter DATA2 according with Z&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data DATA3;&lt;BR /&gt;set DATA2(where=(COL1=&amp;amp;&lt;STRONG&gt;Z&lt;/STRONG&gt;));&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem is my Z can not be a column in a table, it have to be a single variable. Por example&amp;nbsp;&lt;/P&gt;&lt;P&gt;if I try with&amp;nbsp;%let Z ='2';&lt;/P&gt;&lt;P&gt;I get data3 correctly, but I need the info in the table X.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2016 07:06:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Cell-info-to-variable/m-p/304555#M1319</guid>
      <dc:creator>mariange8282</dc:creator>
      <dc:date>2016-10-14T07:06:46Z</dc:date>
    </item>
    <item>
      <title>Re: Cell info to variable</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Cell-info-to-variable/m-p/304556#M1320</link>
      <description>&lt;P&gt;The solution was:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;BR /&gt;select * from X&amp;nbsp;as Z;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;data DATA3;&lt;BR /&gt;set DATA2(where=(COL1=&amp;amp;&lt;STRONG&gt;Z&lt;/STRONG&gt;));&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2016 07:15:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Cell-info-to-variable/m-p/304556#M1320</guid>
      <dc:creator>mariange8282</dc:creator>
      <dc:date>2016-10-14T07:15:10Z</dc:date>
    </item>
    <item>
      <title>Re: Cell info to variable</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Cell-info-to-variable/m-p/304559#M1321</link>
      <description>&lt;P&gt;That code isn't correct. Or at least not cohesive for the portion shown.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2016 07:33:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Cell-info-to-variable/m-p/304559#M1321</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-10-14T07:33:20Z</dc:date>
    </item>
    <item>
      <title>Re: Cell info to variable</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Cell-info-to-variable/m-p/304560#M1322</link>
      <description>&lt;P&gt;That code isn't correct. Or at least not cohesive for the portion shown.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2016 07:33:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Cell-info-to-variable/m-p/304560#M1322</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-10-14T07:33:21Z</dc:date>
    </item>
    <item>
      <title>Re: Cell info to variable</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Cell-info-to-variable/m-p/304571#M1323</link>
      <description>&lt;P&gt;Sorry, that code makes no sense. &amp;nbsp;What is X, why are you selecting all observations from it, then in a separate datastep filtering out where col1= a macro variable - which is also not specified. &amp;nbsp;Just taking your code as basis:&lt;/P&gt;
&lt;PRE&gt;data want;
  set x;
  where col1="&amp;amp;z.";
run;&lt;/PRE&gt;
&lt;P&gt;Would be syntactically correct, and logical per what you have provided there, however that depends on what &amp;amp;z represents.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2016 08:52:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Cell-info-to-variable/m-p/304571#M1323</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-10-14T08:52:22Z</dc:date>
    </item>
    <item>
      <title>Re: Cell info to variable</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Cell-info-to-variable/m-p/304863#M1339</link>
      <description>&lt;P&gt;Yes, you right.. I dont know why my code works yesterday....&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now, the error I have with yours is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ERROR: WHERE clause operator requires compatible variables.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 15 Oct 2016 11:54:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Cell-info-to-variable/m-p/304863#M1339</guid>
      <dc:creator>mariange8282</dc:creator>
      <dc:date>2016-10-15T11:54:22Z</dc:date>
    </item>
    <item>
      <title>Re: Cell info to variable</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Cell-info-to-variable/m-p/304864#M1340</link>
      <description>&lt;P&gt;I think what you're trying to do is this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc SQL;&lt;/P&gt;
&lt;P&gt;create table data3 as&lt;/P&gt;
&lt;P&gt;select *&amp;nbsp;&lt;/P&gt;
&lt;P&gt;from data2&lt;/P&gt;
&lt;P&gt;where col1 in&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; (Select y from x);&lt;/P&gt;
&lt;P&gt;quit; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 15 Oct 2016 12:00:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Cell-info-to-variable/m-p/304864#M1340</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-10-15T12:00:02Z</dc:date>
    </item>
    <item>
      <title>Re: Cell info to variable</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Cell-info-to-variable/m-p/305014#M1342</link>
      <description>&lt;P&gt;Well, that is down to the fact that you haven't told us what the data looks like. &amp;nbsp;This is why posting your test data - in the form of a datastep is so important, we can't see what you are working with.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyways, either the macro variable or the variable in question is a different format to the other, so change one or the other to match your data:&lt;/P&gt;
&lt;PRE&gt;data want;
  set x;
  where col1=&amp;amp;z.;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Oct 2016 08:34:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Cell-info-to-variable/m-p/305014#M1342</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-10-17T08:34:08Z</dc:date>
    </item>
    <item>
      <title>Re: Cell info to variable</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Cell-info-to-variable/m-p/307012#M1367</link>
      <description>&lt;P&gt;I am sorry for not explain myself clear...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my issue:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Need to get the info in a cell, put in a variable and try to filter an other dataset according that info.&lt;BR /&gt;I've try two ways.. no success.&lt;BR /&gt;Frist one:&lt;BR /&gt;Comment: into of the cell is in the location COL1,1.&lt;BR /&gt;Show the error.&lt;BR /&gt;&lt;BR /&gt;%let nombre=d_20500_Ward_6;&lt;BR /&gt;data x_new;&lt;BR /&gt;set s3;&lt;BR /&gt;a = put(COL1,1.);&lt;BR /&gt;data &amp;amp;nombre;&lt;BR /&gt;set CLUSTER.&amp;amp;nombre(where=(NUMCLUSTER='&amp;amp;a.'));&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;Second one:&lt;BR /&gt;Comment: Same error&lt;BR /&gt;&lt;BR /&gt;%let nombre=d_20500_Ward_6;&lt;BR /&gt;PROC SQL ;&lt;BR /&gt;select * from s3 as a;&lt;BR /&gt;CREATE TABLE s4 as select * from cluster.&amp;amp;nombre where NUMCLUSTER="&amp;amp;a.";&lt;BR /&gt;&lt;BR /&gt;Pd: I've been try with NUMCLUSTER=&amp;amp;a, &amp;amp;'a.', &amp;amp;a .. no success.&lt;BR /&gt;&lt;BR /&gt;Any ideas?&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2016 02:52:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Cell-info-to-variable/m-p/307012#M1367</guid>
      <dc:creator>mariange8282</dc:creator>
      <dc:date>2016-10-25T02:52:05Z</dc:date>
    </item>
    <item>
      <title>Re: Cell info to variable</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Cell-info-to-variable/m-p/307056#M1369</link>
      <description>&lt;P&gt;Well, where to start? &amp;nbsp;We cannot see any of the data you have, or what you have set certain macro variables and such like to. &amp;nbsp;We can only see what you have posted here. &amp;nbsp;So your block of code, I have updated this (note consistent casing, indentations, use of code block (its the {i} above post):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%let nombre=d_20500_Ward_6;
data x_new;
  set s3;
  a=put(col1,1.);
run;
data &amp;amp;nombre.;
  set cluster.&amp;amp;nombre. (where=(numcluster="&amp;amp;a."));
run;&lt;/PRE&gt;
&lt;P&gt;Now without seeing anything else, this code looks syntactically correct - assuming a dataset s3 exists and contains a character field called col1. &amp;nbsp;This also assumes that in the library cluster there is a dataset called d_20500_ward_6 which contains a character variable called numcluster. &amp;nbsp;And it assumes there is a macro variable defined somewhere called a. &amp;nbsp;If all those assumptions are true then the code is fine. &amp;nbsp;However, I do not have a dataset called s3, a library called cluster nor a dataset called d_20500_ward_6 so I cannot say. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;Same with you second bit of code:&lt;/P&gt;
&lt;PRE&gt;%let nombre=d_20500_Ward_6;
proc sql;
  /* this code doesn't do anything - just displays data in the output window */
  select  *    
  from    s3;

  create table s4 as 
  select  * 
  from    cluster.&amp;amp;nombre. 
  where   NUMCLUSTER="&amp;amp;a.";
quit;
&lt;/PRE&gt;
&lt;P&gt;Assuming you have a library called cluster and a dataset called&amp;nbsp;&lt;SPAN&gt;d_20500_ward_6 in that libary which contains a character variable numcluster, then the code is good to go. &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;What I am guessing is your problem - as you haven't posted any warning messages - is that the variable numcluster is actually numeric, in which case you need to change either of your codes to:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;%let nombre=d_20500_Ward_6;
data x_new;
  set s3;
  a=put(col1,1.);
run;
data &amp;amp;nombre.;
  set CLUSTER.&amp;amp;nombre. (where=(numcluster=&amp;amp;a.));
run;


%let nombre=d_20500_Ward_6;
proc sql;
  /* this code doesn't do anything - just displays data in the output window */
  select  *    
  from    s3;

  create table s4 as 
  select  * 
  from    cluster.&amp;amp;nombre. 
  where   NUMCLUSTER=&amp;amp;a.;
quit;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2016 08:18:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Cell-info-to-variable/m-p/307056#M1369</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-10-25T08:18:23Z</dc:date>
    </item>
    <item>
      <title>Re: Cell info to variable</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Cell-info-to-variable/m-p/307131#M1371</link>
      <description>Thank you so much</description>
      <pubDate>Tue, 25 Oct 2016 14:05:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Cell-info-to-variable/m-p/307131#M1371</guid>
      <dc:creator>mariange8282</dc:creator>
      <dc:date>2016-10-25T14:05:31Z</dc:date>
    </item>
    <item>
      <title>Re: Cell info to variable</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Cell-info-to-variable/m-p/311918#M1481</link>
      <description>use input statement to change the variable x as numeric</description>
      <pubDate>Wed, 16 Nov 2016 07:12:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Cell-info-to-variable/m-p/311918#M1481</guid>
      <dc:creator>Sabharish</dc:creator>
      <dc:date>2016-11-16T07:12:33Z</dc:date>
    </item>
  </channel>
</rss>

