LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (July 2008, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sat, 5 Jul 2008 12:02:04 -0400
Reply-To:     Alison El Ayadi <alisontetler@YAHOO.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Alison El Ayadi <alisontetler@YAHOO.COM>
Subject:      Re: NOTE: Invalid argument to function INPUT

Thank you so much.

This still leaves me with a character variable though. Isn't there a way to designate a numeric variable and import the values into it from the character variable and have them read as numeric??

On Fri, 4 Jul 2008 23:40:14 -0400, Arthur Tabachneck <art297@NETSCAPE.NET> wrote:

>Alison, > >In SAS, once a variable is declared as character, it must remain character. > >Thus, to do what you want, you have to create a new variable. > >You could do that with your set of if statements, but could also do it >with a format. > >Try something like the following: > >data apa; > input In_what_state_do_you_work____che $20.; > cards; >Connecticut >Maine >New Hampshire >Rhode Island >Vermont >; > >proc format; > value $ states > "Connecticut"=1 > "Maine"=2 > "New Hampshire"=3 > "Rhode Island"=4 > "Vermont"=5 > else=6; >run; > >data apa; > set apa; > options nofmterr; > In_what_state_do_you_work____num = > put (In_what_state_do_you_work____che,$states.); >run; > >HTH, >Art >---------- >On Fri, 4 Jul 2008 22:18:16 -0400, Alison El Ayadi ><alisontetler@YAHOO.COM> wrote: > >>I am bringing in some survey data from survey monkey, so it is all in text >>format. To make it easier to work with I'm trying to switch everything to >>numeric. I have recoded all of my variables in the same manner as the >>example below, but each time I try to run it I get an error that says: >>NOTE: Invalid argument to function INPUT at line 11070 column 7. >> >>I have gone through the frequencies of my old variables and they have all >>been changed, although the freq tables look a little funny with the >>variable values a little lower than the descriptive statistics on the page >>(I think this is due to the fact that they are numbers but in a character >>format). >> >>I have seen the suggestions that others have posted regarding this error, >>that there is still something character that is left in the variable, but >>can't find anything. Does anyone have any suggestions?? >> >>Thanks so much, >>Alison >> >>**here is a sample of the way I am recoding to numeric and then formatting >>into a numeric variable: >> >>data apa; set surveys.apa; options nofmterr; >>If In_what_state_do_you_work____che = 'Connecticut' then >>In_what_state_do_you_work____che = 1; >>else if In_what_state_do_you_work____che = 'Maine' then >>In_what_state_do_you_work____che = 2; >>else if In_what_state_do_you_work____che = 'Massachusetts' then >>In_what_state_do_you_work____che = 3; >>else if In_what_state_do_you_work____che = 'New Hampshire' then >>In_what_state_do_you_work____che = 4; >>else if In_what_state_do_you_work____che = 'Rhode Island' then >>In_what_state_do_you_work____che = 5; >>else if In_what_state_do_you_work____che = 'Vermont' then >>In_what_state_do_you_work____che = 6; >>else In_what_state_do_you_work____che = 0; >>State = input(In_what_state_do_you_work____che,best4.);


Back to: Top of message | Previous page | Main SAS-L page