Hi everyone,
I am trying to dynamically create a dictionary in the CASL. In this case I will not know the dictionary keys until I am iterating through an array creating the dictionary.
Below is example code of what I am trying to do with current output and what I want as an output.
proc cas;
count = {"one", "two", "three"};
do x over count;
print x;
temp_dic.x = "hi there";
end;
print temp_dic;
run;
Current output:
Reading the documentation both the dot and bracket notation should work. I don't understand how the syntax for the dot notation would need to look like but it appears using brackets returns the result you're after.
proc cas;
count = {"one", "two", "three"};
do x over count;
print x;
temp_dict[x] = x;
end;
print temp_dict;
run;quit;
one two three {one=one,two=two,three=three}
Reading the documentation both the dot and bracket notation should work. I don't understand how the syntax for the dot notation would need to look like but it appears using brackets returns the result you're after.
proc cas;
count = {"one", "two", "three"};
do x over count;
print x;
temp_dict[x] = x;
end;
print temp_dict;
run;quit;
one two three {one=one,two=two,three=three}
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.