<?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: Input function doesn't work in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Input-function-doesn-t-work/m-p/514287#M2701</link>
    <description>&lt;P&gt;I see no input function here. Please post the code you have the problem with (as stated in your subject).&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/247190"&gt;@IGK22&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello, I got a problem with next piece of code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data = dbraw.subjtbl(keep=s_siteid s_subjid trtgrp screen_fail)
           out = rand(where=(trtgrp ne ' '));
   by s_siteid s_subjid;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;in this case variable trtgrp in subjtbl is character, but in rand dataset I need it to be a numeric. How can I get numeric trtgrp? Thanks in advance&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 18 Nov 2018 20:37:22 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-11-18T20:37:22Z</dc:date>
    <item>
      <title>Input function doesn't work</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Input-function-doesn-t-work/m-p/514286#M2700</link>
      <description>&lt;P&gt;Hello, I got a problem with next piece of code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data = dbraw.subjtbl(keep=s_siteid s_subjid trtgrp screen_fail)
           out = rand(where=(trtgrp ne ' '));
   by s_siteid s_subjid;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;in this case variable trtgrp in subjtbl is character, but in rand dataset I need it to be a numeric. How can I get numeric trtgrp? Thanks in advance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Nov 2018 20:25:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Input-function-doesn-t-work/m-p/514286#M2700</guid>
      <dc:creator>IGK22</dc:creator>
      <dc:date>2018-11-18T20:25:58Z</dc:date>
    </item>
    <item>
      <title>Re: Input function doesn't work</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Input-function-doesn-t-work/m-p/514287#M2701</link>
      <description>&lt;P&gt;I see no input function here. Please post the code you have the problem with (as stated in your subject).&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/247190"&gt;@IGK22&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello, I got a problem with next piece of code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data = dbraw.subjtbl(keep=s_siteid s_subjid trtgrp screen_fail)
           out = rand(where=(trtgrp ne ' '));
   by s_siteid s_subjid;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;in this case variable trtgrp in subjtbl is character, but in rand dataset I need it to be a numeric. How can I get numeric trtgrp? Thanks in advance&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Nov 2018 20:37:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Input-function-doesn-t-work/m-p/514287#M2701</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-11-18T20:37:22Z</dc:date>
    </item>
    <item>
      <title>Re: Input function doesn't work</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Input-function-doesn-t-work/m-p/514293#M2702</link>
      <description>&lt;P&gt;I just don't know where to put this input function :/, if i do just input(trtgrp) in doesn't work&lt;/P&gt;</description>
      <pubDate>Sun, 18 Nov 2018 20:55:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Input-function-doesn-t-work/m-p/514293#M2702</guid>
      <dc:creator>IGK22</dc:creator>
      <dc:date>2018-11-18T20:55:29Z</dc:date>
    </item>
    <item>
      <title>Re: Input function doesn't work</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Input-function-doesn-t-work/m-p/514306#M2703</link>
      <description>&lt;P&gt;The INPUT function must be used in a SAS data step, or in PROC SQL. The data step would come after your PROC SORT, and you will have to create a new variable with a new name that is numeric, that's the only way — you can't really change a variable from character to numeric, you have to create a new variable that is numeric.&lt;/P&gt;</description>
      <pubDate>Sun, 18 Nov 2018 23:18:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Input-function-doesn-t-work/m-p/514306#M2703</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-11-18T23:18:42Z</dc:date>
    </item>
    <item>
      <title>Re: Input function doesn't work</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Input-function-doesn-t-work/m-p/514307#M2704</link>
      <description>&lt;P&gt;so firstly there should be&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data = dbraw.subjtbl(keep=s_siteid s_subjid trtgrp screen_fail)
           out = rand;
   by s_siteid s_subjid;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and then i just created data step rand where i'm using input? the problem is i don't know how to use it at all, here what i got.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data rand(where=(trtgrp ne .));&lt;BR /&gt; input(trtgrp, TRTMNT.);&lt;BR /&gt;run;&lt;/PRE&gt;&lt;P&gt;and the result&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ERROR 22-322: Syntax error, expecting one of the following: a name, arrayname, ), -, :, [, _ALL_, _CHARACTER_, _CHAR_, _NUMERIC_, {.

ERROR 76-322: Syntax error, statement will be ignored.

469  run;

ERROR: No DATALINES or INFILE statement.
ERROR: Variable trtgrp is not on file WORK.TRTDATA.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I also got created format TRMNT so i want to attach this format to trtgrp, that's why i need to change from character to numeric.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;value TRTMNT
	  1 = DRUG ABC
	  2 = COMPARE XYZ
	  ;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Nov 2018 23:53:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Input-function-doesn-t-work/m-p/514307#M2704</guid>
      <dc:creator>IGK22</dc:creator>
      <dc:date>2018-11-18T23:53:14Z</dc:date>
    </item>
    <item>
      <title>Re: Input function doesn't work</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Input-function-doesn-t-work/m-p/514309#M2705</link>
      <description>&lt;P&gt;also if i do in this way i got an error -&amp;nbsp;ERROR 48-59: The informat TRTMNT was not found or could not be loaded. why cant it see my formats?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data trtdata(where=(trtgrp ne .));
  input trtgrp TRTMNT.;
run;&lt;BR /&gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 18 Nov 2018 23:59:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Input-function-doesn-t-work/m-p/514309#M2705</guid>
      <dc:creator>IGK22</dc:creator>
      <dc:date>2018-11-18T23:59:31Z</dc:date>
    </item>
    <item>
      <title>Re: Input function doesn't work</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Input-function-doesn-t-work/m-p/514314#M2707</link>
      <description>&lt;P&gt;what are you really asking to be solved.&amp;nbsp; You have datasteps that just don't make since, you have formats that need quotes, and it seems that your original question is not even supported by the sample code that you provided.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;to change trtgrp to numeric you have to assign a dummy variable to trtgrp, drop trtgrp and then recreate trtgrp as numeric.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/247190"&gt;@IGK22&lt;/a&gt; wrote&amp;nbsp;&lt;SPAN&gt;How can I get numeric trtgrp? &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;data have2;&lt;/P&gt;
&lt;P&gt;length dummy 8.;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;dummy = trtgrp;&lt;/P&gt;
&lt;P&gt;drop trtgrp;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;data have3;&lt;/P&gt;
&lt;P&gt;set have2;&lt;/P&gt;
&lt;P&gt;trtgrp=dummy;&lt;/P&gt;
&lt;P&gt;drop dummy;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Nov 2018 00:56:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Input-function-doesn-t-work/m-p/514314#M2707</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2018-11-19T00:56:07Z</dc:date>
    </item>
    <item>
      <title>Re: Input function doesn't work</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Input-function-doesn-t-work/m-p/514315#M2708</link>
      <description>That's exactly what i needed, thanx</description>
      <pubDate>Mon, 19 Nov 2018 01:04:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Input-function-doesn-t-work/m-p/514315#M2708</guid>
      <dc:creator>IGK22</dc:creator>
      <dc:date>2018-11-19T01:04:48Z</dc:date>
    </item>
    <item>
      <title>Re: Input function doesn't work</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Input-function-doesn-t-work/m-p/514316#M2709</link>
      <description>&lt;P&gt;You have several issues here.&amp;nbsp; Locating formats is just one (and not the easiest one).&amp;nbsp; So let me try to steer you in a different direction in case it is appropriate.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set rand;&lt;/P&gt;
&lt;P&gt;if trtgrp='DRUG ABC' then new_group = 1;&lt;/P&gt;
&lt;P&gt;else if trtgrp='COMPARE XYZ' then new_group = 2;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;*** optionally:&amp;nbsp; drop trtgrp;&lt;/P&gt;
&lt;P&gt;*** optionally:&amp;nbsp; rename new_group = trtgrp;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you only have these two categories, this makes the most sense.&amp;nbsp; A more complex program that incorporates PROC FORMAT would only be appropriate if you have many more categories.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have the option of just using a new variable (and applying y our format to the new variable) or replacing the original variable through the combination of drop and rename.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Nov 2018 01:05:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Input-function-doesn-t-work/m-p/514316#M2709</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-11-19T01:05:54Z</dc:date>
    </item>
    <item>
      <title>Re: Input function doesn't work</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Input-function-doesn-t-work/m-p/514317#M2710</link>
      <description>&lt;P&gt;If your problem has been solved please mark the solution that applies.&lt;/P&gt;
&lt;P&gt;Thank You.&amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Nov 2018 01:27:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Input-function-doesn-t-work/m-p/514317#M2710</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2018-11-19T01:27:23Z</dc:date>
    </item>
    <item>
      <title>Re: Input function doesn't work</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Input-function-doesn-t-work/m-p/514361#M2724</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/247190"&gt;@IGK22&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data rand(where=(trtgrp ne .));&lt;BR /&gt; input(trtgrp, TRTMNT.);&lt;BR /&gt;run;&lt;/PRE&gt;
&lt;BR /&gt;&amp;nbsp;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Functions return values and are not designed to be used on their own, but as a part of an expression that is on the right side of an assignment or part of a condition (the exception is substr()).&lt;/P&gt;
&lt;P&gt;CALL routines, OTOH, are used as stand-alone statements.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Nov 2018 08:02:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Input-function-doesn-t-work/m-p/514361#M2724</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-11-19T08:02:33Z</dc:date>
    </item>
    <item>
      <title>Re: Input function doesn't work</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Input-function-doesn-t-work/m-p/514427#M2733</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/247190"&gt;@IGK22&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;so firstly there should be&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data = dbraw.subjtbl(keep=s_siteid s_subjid trtgrp screen_fail)
           out = rand;
   by s_siteid s_subjid;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and then i just created data step rand where i'm using input? the problem is i don't know how to use it at all, here what i got.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data rand(where=(trtgrp ne .));&lt;BR /&gt; input(trtgrp, TRTMNT.);&lt;BR /&gt;run;&lt;/PRE&gt;
&lt;P&gt;and the result&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ERROR 22-322: Syntax error, expecting one of the following: a name, arrayname, ), -, :, [, _ALL_, _CHARACTER_, _CHAR_, _NUMERIC_, {.

ERROR 76-322: Syntax error, statement will be ignored.

469  run;

ERROR: No DATALINES or INFILE statement.
ERROR: Variable trtgrp is not on file WORK.TRTDATA.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The SAS documentation for the INPUT function is very clear and gives examples of use.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=p19en16vskd2vhn1vwmxpxnglxxs.htm&amp;amp;locale=en" target="_blank"&gt;https://documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=p19en16vskd2vhn1vwmxpxnglxxs.htm&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assuming you have properly defined the format TRTMNT, then this is the correct syntax&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;newvariablename = input(trtgrp, TRTMNT.);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 19 Nov 2018 13:39:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Input-function-doesn-t-work/m-p/514427#M2733</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-11-19T13:39:23Z</dc:date>
    </item>
  </channel>
</rss>

