04-13-2015 11:46 AM
can any one know the format for this
i have the dataset like this
this over all is one dataset.
i have read this data from excel using libname statement.
and the variable amount is in character type.
now i have to convert the data i.e. amount into numeric.
can any one know the process please comment.
04-13-2015 01:51 PM
Is all of this in one column (variable) in the SAS data set? If so this is likely to be a mess. SAS can only have one characteristic per variable, either numeric or character. So you will have to create new variables using a data step. You may need to provide a bit more data for input example AND an example of what the output should look like.
It looks like you actually have 3 values for the rows that start with Fixed and Variable, is that the actual case? or did we lose something in pasting into the forum?
04-14-2015 03:41 AM
Read the column into a char variable, then check that variable for its layout and select the proper conversion.
It would be nice if you could provide an example of the data in csv form, so that we can determine the actual positioning of the data in the cells.
(ie is "product amount" in one or 2 cells?)
04-14-2015 04:32 AM
Am linking this thread: https://communities.sas.com/thread/75128
Here, as its exactly the same question.
04-14-2015 09:47 AM
data have; input p $ a : $20.; cards; fixed 1,52,132 variable 2,50,478 product 4.5% variable 5.6% ; run; data want; set have; length fmt $ 20; if findc(a,',') then fmt='comma32.'; else if findc(a,'%') then fmt='percent12.'; else fmt='best32.'; v=inputn(a,fmt); run;