Date: Jan 11, 2013 1:12 PM
Author: Kevin Ellis
Subject: Question about using datasetfun(@(x,y)

Hello,

I had a quick question about using "datasetfun" where the function includes different variables from different columns in a dataset. My dataset is <57617x29> and called SASDoc32. The columns of interest look like:

SASDoc32.DocumentNumber(1:5)

ans =

'32115466B2510'
'32119532F2370'
'32116183B2360'
'32112922F2550'
'32115841F2520'

SASDoc32.DocumentSuffix(1:5)

ans =

'001'
'001'
'001'
'001'
'001'

This is only a portion of the dataset. Anyways, all I want to do is append the DocumentSuffix to the DocumentNumber (i.e. for the first entry: '32115466B2510001') in a separate column of the dataset. So I actually have two questions:

1) How to add a new column to a dataset without receiving all these warnings? I have been just assigning values to them and always receive the following warning:

Warning: Observations with default values added to dataset variable 'DocNo'

So is there a proper way to add a column to a dataset? My method works, but warnings are annoying and seem to suggest a better way.

2) My most important question is appending the DocumentSuffix to the DocumentNumber. I have tried using datasetfun in a way cellfun should work. My attempt at this is given by:

SASDoc32(:,'DocNo') = datasetfun(@(x,y) [x,y],'DataVars',{'DocumentNumber','DocumentSuffix'},'DatasetOutput',false);

I always receive the error that I don't have enough input arguments. Does datasetfun not support the @(x,y) command? Any help would be much appreciated. Thanks.

Kevin Ellis