BookmarkSubscribeRSS Feed
MichalK
SAS Employee

Mała zagadka.

Mamy kod poniżej:

data x;
	a = 1;
	b = 2;
	c = 3;
run;
data y;
	retain d;
	set x;
run;

Ile zmiennych będzie miał zbiór y?

1 REPLY 1
yabwon
Onyx | Level 15

Hej, 

 

3

 

W Twoim przykładzie `retain` mówi tylko "utrzymuj zmienną", więc nie tworzy tej zmiennej, Żeby `d` się "zmaterializowała" potrzebny jest jakiś kawałek kodu który ją utworzy. I może to być np. `d=17;` ale może być to `retain d 0`, który zostanie zinterpretowany "utrzymuj zmienną, dla której inicjacja ustala wartość 0".

 

Fajna lektura:

https://support.sas.com/resources/papers/proceedings/proceedings/sugi22/ADVTUTOR/PAPER34.PDF

 

All the best

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation