Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.
|
|
|
Help using datasetfun
Posted:
Dec 30, 2012 6:03 PM
|
|
Hello,
I have a large dataset (411,000 entries with 34 variables). My question involves using datasetfun to convert string variables into numbers. A portion of my dataset looks like this:
SAS.DocumentType(1:15)
ans =
'27' '49' '28' '13' '32' '78' '15' '27' '35' '27'
All I want to do is convert these strings into numbers using str2num and datasetfun. I have tried many combinations of the following code to accomplish this:
SAS.DocumentType = datasetfun(@str2num,SAS.DocumentType);
I also seem to receive the following error message:
Undefined function 'datasetfun' for input arguments of type 'function_handle'.
I think I understand why I am receiving this error. The only way for str2num to work is if I pass it something in the {} brackets. For example, str2num(SAS.DocumentType{1}) works perfectly, but I want to do this for all 400,000 entries without using a FOR-loop. Could someone help me understand how to use datasetfun to accomplish this? Thanks.
Kevin
|
|
|
|