TMSCORE Procedure

Getting Started: TMSCORE Procedure

Note: Input data must be in a CAS table that is accessible in your CAS session. You must refer to this table by using a two-level name. The first level must be a CAS engine libref, and the second level must be the table name. For more information, see the sections Using CAS Sessions and CAS Engine Librefs and Loading a SAS Data Set onto a CAS Server in Chapter 2, Shared Concepts.

The following DATA steps generate two data tables: the mylib.getstart data table contains 36 observations, and the mylib.getstart_score data table contains 31 observations. Both data tables have two variables: the text variable contains the input documents, and the did variable contains the IDs of the documents. Each row in each data table represents a "document" for analysis.

data mylib.getstart;
   infile datalines delimiter='|' missover;
   length text $150;
   input text$ did;
   datalines;
      High-performance analytics hold the key to |1
      unlocking the unprecedented business value of big data.|2
      Organizations looking for optimal ways to gain insights|3
      from big data in shorter reporting windows are turning to SAS.|4
      As the gold-standard leader in business analytics |5
      for more than 36 years,|6
      SAS frees enterprises from the limitations of |7
      traditional computing and enables them |8
      to draw instant benefits from big data.|9
      Faster Time to Insight.|10
      From banking to retail to health care to insurance, |11
      SAS is helping industries glean insights from data |12
      that once took days or weeks in just hours, minutes or seconds.|13
      It's all about getting to and analyzing relevant data faster.|14
      Revealing previously unseen patterns, sentiments and relationships.|15
      Identifying unknown risks.|16
      And speeding the time to insights.|17
      High-Performance Analytics from SAS Combining industry-leading |18
      analytics software with high-performance computing technologies|19
      produces fast and precise answers to unsolvable problems|20
      and enables our customers to gain greater competitive advantage.|21
      SAS In-Memory Analytics eliminate the need for disk-based processing|22
      allowing for much faster analysis.|23
      SAS In-Database executes analytic logic into the database itself |24
      for improved agility and governance.|25
      SAS Grid Computing creates a centrally managed,|26
      shared environment for processing large jobs|27
      and supporting a growing number of users efficiently.|28
      Together, the components of this integrated, |29
      supercharged platform are changing the decision-making landscape|30
      and redefining how the world solves big data business problems.|31
      Big data is a popular term used to describe the exponential growth,|32
      ;
run;
data mylib.getstart_score;
   infile datalines delimiter='|' missover;
   length text $150;
   input text$ did;
   datalines;
      Big data according to SAS|1
      At SAS, consider two other dimensions|2
      when thinking about big data:|3
      Variability. In addition to the|4
      increasing velocities and varieties of data, data|5
      flows can be highly inconsistent with periodic peaks.|6
      Is something big trending in the social media?|7
      Perhaps there is a high-profile IPO looming.|8
      Maybe swimming with pigs in the Bahamas is suddenly|9
      the must-do vacation activity. Daily, seasonal and|10
      event-triggered peak data loads can be challenging|11
      to manage - especially with social media involved.|12
      Complexity. When you deal with huge volumes of data,|13
      it comes from multiple sources. It is quite an|14
      undertaking to link, match, cleanse and|15
      transform data across systems. However,|16
      ;
run;

The following statements use PROC TEXTMINE to process the input text data table mylib.getstart and create three data tables (mylib.outconfig, mylib.outterms, and mylib.svdu), which can be used in PROC TMSCORE for scoring:

 proc textmine data    = mylib.getstart;
 doc_id      did;
 variables   text;
 parse
     outterms  = mylib.outterms
     outconfig = mylib.outconfig
     reducef   = 2;
 svd
     k         = 5
     svdu      = mylib.svdu;
 run;

The following statements then use PROC TMSCORE to score the input text data table mylib.getstart_score. The statements take the three data tables that are generated by PROC TEXTMINE as input and create a data table named mylib.docpro, which contains the projection of the documents in the input data table mylib.getstart_score.

 proc tmscore
     data      = mylib.getstart_score
     terms     = mylib.outterms
     config    = mylib.outconfig
     svdu      = mylib.svdu
     svddocpro = mylib.docpro;
 doc_id      did;
 variables   text;
 run;

The output from this analysis is presented in Figure 1.

The following statements use PROC PRINT to show the contents of the first 10 rows of the sorted mylib.docpro data table, which is generated by PROC TMSCORE:

 data docpro;
 set mylib.docpro;
 run;
 proc sort data=docpro;
 by did;
 run;
 proc print data = docpro (obs=10);
 run;

Figure 1 shows the output of PROC PRINT.

Figure 1: The mylib.docpro Data Table

ObsdidCOL1COL2COL3COL4COL5
110.8748434839-0.433073328-0.003022785-0.1107360770.186613921
220.47852500640.06077225460.6210373982-0.608626031-0.105865269
330.8229887937-0.487741611-0.1709088350.04374855050.2316760686
440.66228050540.02253774210.3697247930.5253883642-0.384898982
550.8459948728-0.126359432-0.2527709830.40022539310.2103626256
660.7096557443-0.109534123-0.192458858-0.6669368890.0504556645
770.9289563857-0.3573070720.0823110535-0.040749556-0.030595003
880.751458757-0.219695792-0.20757228-0.4522339270.3734189595
990.9000571807-0.2096658440.2387774329-0.23889197-0.178474842
10100.53887312750.4843343505-0.1485411310.6718832675-0.039298813


Last updated: September 04, 2026