options metaserver="myserver" metaport=8561 metauser="sasadm@saspw" metapass="adminpw" metarepository="Foundation"; data _null_; length uri $256 curi $256 curi1 $256 curi2 $256 luri $256; rc=0; /* Create a SASLibrary object in the Shared Data folder. */ rc=metadata_newobj("SASLibrary", luri, "DS Test Library", "Foundation", "omsobj:Tree?@Name='Shared Data'", "Members"); put rc=; put luri=; /* Add PublicType= and UsageVersion= attribute values. */ rc=metadata_setattr(luri, "PublicType", "Library"); put rc=; put luri=; rc=metadata_setattr(luri, "UsageVersion", "1000000.0"); put rc=; put luri=; /* Create a PhysicalTable object in the Shared Data folder. */ rc=metadata_newobj("PhysicalTable", uri, "TestTable", "Foundation", "omsobj:Tree?@Name='Shared Data'", "Members"); put rc=; put uri=; /* Add PublicType= and UsageVersion= attribute values. */ rc=metadata_setattr(uri, "PublicType", "Table"); put rc=; rc=metadata_setattr(uri, "UsageVersion", "1000000.0"); put rc=; /* Create a couple of columns on the new PhysicalTable object. */ rc=metadata_newobj("Column", curi, "Column1", "Foundation", uri, "Columns"); put rc=; put curi=; /* Add PublicType= and UsageVersion= attribute values to Column. */ rc=metadata_setattr(curi, "PublicType", "Column"); put rc=; rc=metadata_setattr(curi, "UsageVersion", "1000000.0"); put rc=; rc=metadata_newobj("Column", curi1, "Column2", "Foundation", uri, "Columns"); put rc=; put curi1=; /* Add PublicType= and UsageVersion= attribute values to Column2. */ rc=metadata_setattr(curi1, "PublicType", "Column"); put rc=; rc=metadata_setattr(curi1, "UsageVersion", "1000000.0"); put rc=; rc=metadata_newobj("Column", curi2, "Column3", "Foundation", uri, "Columns"); put rc=; put curi2=; /* Add PublicType= and UsageVersion= attribute values to Column3. */ rc=metadata_setattr(curi2, "PublicType", "Column"); put rc=; rc=metadata_setattr(curi2, "UsageVersion", "1000000.0"); put rc=; /* Create an association between library and the table */ rc=metadata_setassn(luri, "Tables", "Append", uri); put=rc; run;