BookmarkSubscribeRSS Feed
EloarL
Obsidian | Level 7

hello, could anyone help me with an example of Proc for cluster analysis with graph plot Error?

8 REPLIES 8
Community_Guide
SAS Moderator

Hello @EloarL,


Your question requires more details before experts can help. Can you revise your question to include more information? 

 

Review this checklist:

  • Specify a meaningful subject line for your topic.  Avoid generic subjects like "need help," "SAS query," or "urgent."
  • When appropriate, provide sample data in text or DATA step format.  See this article for one method you can use.
  • If you're encountering an error in SAS, include the SAS log or a screenshot of the error condition. Use the Photos button to include the image in your message.
    use_buttons.png
  • It also helps to include an example (table or picture) of the result that you're trying to achieve.

To edit your original message, select the "blue gear" icon at the top of the message and select Edit Message.  From there you can adjust the title and add more details to the body of the message.  Or, simply reply to this message with any additional information you can supply.

 

edit_post.png

SAS experts are eager to help -- help them by providing as much detail as you can.

 

This prewritten response was triggered for you by fellow SAS Support Communities member @Rick_SAS

.
EloarL
Obsidian | Level 7
I need to generate a cluster analysis in SAS Guide using the K means and centroids method and plot the elbow graph. However I need the help or example of some Proc in this regard.
Reeza
Super User

Did you try PROC CLUSTER? The examples in the documentation is pretty straightforward:

 

https://documentation.sas.com/?docsetId=statug&docsetTarget=statug_cluster_examples01.htm&docsetVers...

 


@EloarL wrote:
I need to generate a cluster analysis in SAS Guide using the K means and centroids method and plot the elbow graph. However I need the help or example of some Proc in this regard.

 

EloarL
Obsidian | Level 7

yes, i tested them all but i didn't get any results i need because i need a Procesar with a cluster parsing function in R language.
Code used in the R language was as follows:
erro = 0
for (i in 2:20){
erro[i] <- ml_compute_cost(
ml_kmeans(
variaveis_clusters_tratado, CODCLI ~ ., k=i), variaveis_clusters_tratado)
}

plot(erro)

I need a function similar to this in SAS GUIDE
PaigeMiller
Diamond | Level 26

Can you explain what the R code does? Most of us don't understand R.

 

 

--
Paige Miller
EloarL
Obsidian | Level 7
cluster <- ml_kmeans(variaveis_clusters_tratado, CODCLI ~ ., k = 5) Create a K-MEANS model with dataset data variaveis_clusters_tratado,following the formula CODCLI ~ ., com 5 Clusters, isto é, k=5.clusters <- ml_predict(cluster, variaveis_clusters_tratado) predict the values ​​of variaveis_clusters_tratado using the template that was created in the first line, that is, the clusters. While doing so, this line overlaps the created model in R's memory. That is, it uses the model and then replaces it with the prediction result, which is likely to be a dataframe.

How to do this in SAS GUIDE?
Reeza
Super User
Sounds like you're scoring a data set after? You first create your clusters and then you want to apply that logic to a different data set? If so, take a look at PROC SCORE and PLM.
PaigeMiller
Diamond | Level 26

Certainly, SAS can do K-means clustering, its in PROC FASTCLUS.

https://documentation.sas.com/?docsetId=statug&docsetVersion=14.2&docsetTarget=statug_fastclus_overv...

 

If that doesn't do what you want, please describe in detail exactly what you need, give us a complete description of what you need, starting from the beginning; instead of making us ask question after question as we have been doing to get this far.

--
Paige Miller

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 8 replies
  • 1062 views
  • 6 likes
  • 4 in conversation