42 %macro mm_createapplication(
    43     tree=/User Folders/sasdemo
    45     ,ClassIdentifier=mcore
    46     ,desc=Created by mm_createapplication
    47     ,params= param1=1
param2=blah
    55 %
if &mDebug=1 %then %let mD=;
    56 %
else %let mD=%str(*);
    57 %&mD.put Executing &sysmacroname..sas;
    60 %mf_verifymacvars(tree name)
    68   rc=metadata_pathobj(
"",
"&tree",
"Folder",type,uri);
    69   call symputx(
'type',type,
'l');
    70   call symputx(
'treeuri',uri,
'l');
    74   iftrue= (&type ne Tree)
    75   ,mac=mm_createapplication.sas
    76   ,msg=Tree &tree does not exist!
    84   rc=metadata_pathobj("","&tree/&name","Application",type,uri);
    85   call symputx('type',type,'l');
    90   iftrue= (&type = SoftwareComponent)
    91   ,mac=mm_createapplication.sas
    92   ,msg=Application &name already exists in &tree!
    99 filename &frefin temp;
   104   name=quote(symget('name'));
   105   desc=quote(symget('desc'));
   106   ClassIdentifier=quote(symget('ClassIdentifier'));
   107   version=quote(symget('version'));
   108   params=quote(symget('params'));
   109   treeuri=quote(symget('treeuri'));
   111   put "<AddMetadata><Reposid>$METAREPOSITORY</Reposid><Metadata> "/
   112     '<SoftwareComponent IsHidden="0" Name=' name ' ProductName=' name /
   113     '  ClassIdentifier=' ClassIdentifier ' Desc=' desc /
   114     '  SoftwareVersion=' version '  SpecVersion=' version /
   115     '  Major="1" Minor="1" UsageVersion="1000000" PublicType="Application" >' /
   117     '    <TextStore Name="Public Configuration Properties" IsHidden="0" ' /
   118     '       UsageVersion="0" StoredText=' params '/>' /
   120     "<Trees><Tree ObjRef=" treeuri "/></Trees>"/
   121     "</SoftwareComponent></Metadata><NS>SAS</NS>"/
   122     "<Flags>268435456</Flags></AddMetadata>";
   125 filename &frefout temp;
   127 proc metadata in= &frefin out=&frefout verbose;
   130 %if &mdebug=1 %then %do;
   133     infile &frefout lrecl=1048576;
   139 %put NOTE: Checking to ensure application (&name) was created;
   141   length type uri $256;
   142   rc=metadata_pathobj("","&tree/&name","Application",type,uri);
   143   call symputx('apptype',type,'l');
   144   %if &mdebug=1 %then putlog (_all_)(=);;
   146 %if &apptype ne SoftwareComponent %then %do;
   147   %put %str(ERR)OR: Could not find (&name) at (&tree)!!;
   150 %else %put NOTE: Application (&name) successfully created in (&tree)!;