Hello Forum,
I have successfully written a ado-command, unfortunately I have problem with one little thing. For this thread I shortened my command and unneccessary information.
First for my example I use the following data:
Code:
clear
version 16.0
sysuse auto
encode make, gen(make2)
keep if make2 <= 6
The ado command creates a graph, looking like this:
Code:
graph bar, over(make2) over(foreign, label(labsize(small))) stack asyvars percentage
As I said, I sucessfully got the command to work with other things, but now I wanted to add the option for the size of of the label. This is how my command looks like (shortened):
Code:
syntax varlist(max=2 numeric) [if] [in], [size(string)]
The option for size should be working like this: when the user uses the ",size(string)" option - e.g. ",size(tiny)" I would like to read out the string information "tiny" and add it to the part of ther over-option "over(var1, label(labsize(`size'))". I know that it has to work somehow like this:
Code:
if "`size'" != "" {
local size `size'
}
With the following code in my ado:
Code:
graph bar, over(var1) over(var2, label(labsize(`size'))) stack asyvars percentage
"size" should be the string of the size the user is using. But I can't get it to work and maybe it's not the correct approach. But using it like in my example, I get the error message "(note: named style vtiny not found in class gsize, default attributes used)". So I might be close.
So I would need some help to get this fixed. Thanks in advance.
Nick
0 Response to ado programming option help
Post a Comment